(2.10) KVM: use running HVPs to calc blockdev options stable-2.8-grnet-rebased
authorApollon Oikonomopoulos <apoikos@gmail.com>
Fri, 28 Mar 2014 16:07:53 +0000 (18:07 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Tue, 1 Apr 2014 11:12:04 +0000 (14:12 +0300)
commit5f045eb857e5aa617689a5f9f4334a109234763b
tree881037d54c9297ec2afe78cac275f3ed3535f5d4
parentbf9695690ec58cf15b969d2f6e0bc994c76fa9e8
(2.10) KVM: use running HVPs to calc blockdev options

Commit 0fe22ad2 moved the call to _GenerateKVMBlockDevicesOptions() from
_GenerateKVMRuntime() to _ExecuteKvmRuntime. However, while in
_GenerateKVMRuntime() there is only one set of HVPs, those of the
instance's configuration, in _ExecuteKVMRuntime there are two sets of
HVPs:

  - The instance's configured HVPs
  - The HVPs the instance used when it was started

Currently, _GenerateKVMBlockDevicesOptions() uses the first set of HVPs
only, meaning that it will always read the configured HVPs. Since
_ExecuteKVMRuntime() is also called at migration time, it should use the
instance's running HVPs, otherwise migration while fail.

The following scenario will lead to a crash on migration:

 1. Start the instance (assuming 'paravirtual' disk_type)
 2. gnt-instance modify -H disk_type=scsi <instance_name>
 3. gnt-instance migrate <instance_name>

Step 3 will start the instance on the remote node with all disks
configured as 'scsi' and qemu will crash post-migration.

We fix this by making sure _GenerateKVMBlockDevicesOptions gets the
running HVPs as well.

Signed-off-by: Apollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
lib/hypervisor/hv_kvm.py