[PATCH virt-manager 08/10] domain: Move set boot order responsibility to guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move set boot order responsibility to guest XML builder.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
---
 virtManager/domain.py | 6 ++----
 virtinst/guest.py     | 9 ++++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 19d55aab2eed..5b3c7efbde53 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -527,10 +527,8 @@ class vmmDomain(vmmLibvirtObject):
 
         guest = self._make_xmlobj_to_define()
         if boot_order != _SENTINEL:
-            if self.can_use_device_boot_order():
-                guest.set_device_boot_order(boot_order)
-            else:
-                guest.os.bootorder = boot_order
+            legacy = not self.can_use_device_boot_order()
+            guest.set_boot_order(boot_order, legacy=legacy)
 
         if boot_menu != _SENTINEL:
             guest.os.enable_bootmenu = bool(boot_menu)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index aac5116319c5..5104087c62d2 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -372,7 +372,7 @@ class Guest(XMLBuilder):
             return self._get_old_boot_order()
         return self._get_device_boot_order()
 
-    def set_device_boot_order(self, boot_order):
+    def _set_device_boot_order(self, boot_order):
         """Sets the new device boot order for the domain"""
         # Unset the traditional boot order
         self.os.bootorder = []
@@ -389,6 +389,13 @@ class Guest(XMLBuilder):
             except KeyError:
                 pass
 
+    def set_boot_order(self, boot_order, legacy=False):
+        """Modifies the boot order"""
+        if legacy:
+            self.os.bootorder = boot_order
+        else:
+            self._set_device_boot_order(boot_order)
+
     def set_os_name(self, name):
         obj = OSDB.lookup_os(name)
         if obj is None:
-- 
2.17.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux