(grnet) Move disk options before nic ones in kvm command
authorDimitris Aragiorgis <dimara@grnet.gr>
Thu, 28 Nov 2013 06:25:59 +0000 (08:25 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Thu, 27 Mar 2014 07:59:00 +0000 (09:59 +0200)
Older versions of Ganeti did ensure that during startup
disk devices will be inserted before nic devices in PCI
configuration space. KVM inserts devices to PCI slots
depending on the order of command line options.

Upon migration kvm command options are re-generated based
on runtime files info. To be able to migrate instances
with old format runtime files put disk options before
NIC ones so that disk occupy the first pci slots available
and not the other way around.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

lib/hypervisor/hv_kvm.py

index 8ebfd3c..598d511 100644 (file)
@@ -1760,6 +1760,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     tapfds = []
     taps = []
     devlist = self._GetKVMOutput(kvm_path, self._KVMOPT_DEVICELIST)
+
+    bdev_opts = self._GenerateKVMBlockDevicesOptions(instance,
+                                                     kvm_disks,
+                                                     kvmhelp,
+                                                     devlist)
+    kvm_cmd.extend(bdev_opts)
+
     if not kvm_nics:
       kvm_cmd.extend(["-net", "none"])
     else:
@@ -1847,11 +1854,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
         continue
       self._ConfigureNIC(instance, nic_seq, nic, taps[nic_seq])
 
-    bdev_opts = self._GenerateKVMBlockDevicesOptions(instance,
-                                                     kvm_disks,
-                                                     kvmhelp,
-                                                     devlist)
-    kvm_cmd.extend(bdev_opts)
     # CPU affinity requires kvm to start paused, so we set this flag if the
     # instance is not already paused and if we are not going to accept a
     # migrating instance. In the latter case, pausing is not needed.