[virt-tools-list] [PATCH virt-manager 08/10] domain: Move set boot order responsibility to guest
Marc Hartmayer
mhartmay at linux.ibm.com
Wed Feb 6 09:55:41 UTC 2019
Move set boot order responsibility to guest XML builder.
Signed-off-by: Marc Hartmayer <mhartmay at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
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
More information about the virt-tools-list
mailing list