Hotplug: do not allow disk/0 to be hotplug-able
authorDimitris Aragiorgis <dimara@grnet.gr>
Tue, 6 Nov 2012 18:10:06 +0000 (20:10 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Tue, 6 Nov 2012 18:10:06 +0000 (20:10 +0200)
BIOS boots from first disk. If we enable hotplug in disk/0
it will added at the end of PCI address space (slot 31). If
another disk gets added then it will be added just before and
BIOS will try to boot from an non bootable device and the
instance will hung.

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

lib/cmdlib.py

index 2267bb5..5d5a8fc 100644 (file)
@@ -8732,6 +8732,9 @@ def _GetPCIInfo(lu, dev_type):
       if lu.hotplug_info is not None:
         idx = getattr(lu.hotplug_info, dev_type)
         setattr(lu.hotplug_info, dev_type, idx+1)
+        if dev_type == 'disks' and idx == 0:
+          lu.LogInfo("Disk 0 cannot be hotpluggable.")
+          return None, None
         pci = lu.hotplug_info.pci_pool.pop()
         lu.LogInfo("Choosing pci slot %d" % pci)
         return idx, pci