Restrict instance migration when vm consoles are open

Registered by Abhishek Kekane

Administrators don't want to bother users by performing live migration
specially when they are connected to the vm console. When vm will be live
migrated from source to the destination compute node, the vnc server running
on the source compute node will abruptly terminate all of the opened tcp
connections on the graphics port of the vm without intimating to the users.

We are thinking of introducing a new ‘force' parameter to the live migration
api. If force parameter is set to false, then it will check whether users are
connected to the vm console using vnc/spice before actually performing live
migration. If users are connected to the vm console, then it will return 409
error to the administrator.
Then the administrator (operations team) will inform to the owner of the vm
that they want to perform live migration within a specified time frame and
refrain them from connecting to the vm consoles otherwise their connections
will be terminated automatically. This way users will be informed when the vm
consoles will be terminated after the live migration is finished.

Administrator will run live migration api with force parameter set as ‘true’
within the given time frame communicated to the user earlier. when force
parameter is set to True, then it won’t check whether users are connected to
the vm consoles or not and straight way perform live migration.

force parameter default value will be set to “True”.

Libvirt didn't expose any api to check whether the vm console is open or not.
So in order to detect that, first we need to get all of the opened tcp
connections on the compute node where the vm is running using command

sudo netstat -nt

Then using output of netstat command we can filter out all of the tcp
connections opened for a given vm’s graphics port
<vncserver_listen:graphics port of a vm>.

Blueprint information

Status:
Not started
Approver:
Russell Bryant
Priority:
Undefined
Drafter:
Abhishek Kekane
Direction:
Needs approval
Assignee:
Abhishek Kekane
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/restrict-instance-migration,n,z

Addressed by: https://review.openstack.org/89570
    Restrict live migration when consoles are open

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.