[virt-tools-list] [virt-manager PATCH] domain: only the first device from each group is bootable

Pavel Hrdina phrdina at redhat.com
Tue Sep 5 14:17:38 UTC 2017


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1488480

This also fixes an issue with floppy not showing at all, the proper
boot.dev name is 'fd' but we were looking for 'floppy'.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtManager/domain.py | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 21851107..624361ef 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -1294,19 +1294,34 @@ class vmmDomain(vmmLibvirtObject):
     def _convert_old_boot_order(self):
         boot_order = self._get_old_boot_order()
         ret = []
-        disks = self.get_disk_devices()
-        nets = self.get_network_devices()
+        disk = None
+        cdrom = None
+        floppy = None
+        net = None
+
+        for d in self.get_disk_devices():
+            if not cdrom and d.device == "cdrom":
+                cdrom = d
+            if not floppy and d.device == "floppy":
+                floppy = d
+            if not disk and d.device not in ["cdrom", "floppy"]:
+                disk = d
+            if cdrom and disk and floppy:
+                break
+
+        for n in self.get_network_devices():
+            net = n
+            break
 
         for b in boot_order:
-            if b == "network":
-                ret += [n.vmmidstr for n in nets]
-            if b == "hd":
-                ret += [d.vmmidstr for d in disks if
-                        d.device not in ["cdrom", "floppy"]]
-            if b == "cdrom":
-                ret += [d.vmmidstr for d in disks if d.device == "cdrom"]
-            if b == "floppy":
-                ret += [d.vmmidstr for d in disks if d.device == "floppy"]
+            if b == "network" and net:
+                ret.append(net.vmmidstr)
+            if b == "hd" and disk:
+                ret.append(disk.vmmidstr)
+            if b == "cdrom" and cdrom:
+                ret.append(cdrom.vmmidstr)
+            if b == "fd" and floppy:
+                ret.append(floppy.vmmidstr)
         return ret
 
     def _get_device_boot_order(self):
-- 
2.13.5




More information about the virt-tools-list mailing list