[virt-tools-list] [PATCH virt-manager 10/14] domain: os: use decorator syntax for declaring properties
Marc Hartmayer
mhartmay at linux.ibm.com
Tue Dec 18 13:44:59 UTC 2018
This makes it's easier to understand the code.
Signed-off-by: Marc Hartmayer <mhartmay at linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
virtinst/domain/os.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index c6e49f80a432..d0a73f63dfbd 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -67,17 +67,20 @@ class DomainOs(XMLBuilder):
"nvram", "nvram_template", "kernel", "initrd",
"kernel_args", "dtb", "_bootdevs", "smbios_mode"]
- def _get_bootorder(self):
+ _bootdevs = XMLChildProperty(_BootDevice)
+
+ @property
+ def bootorder(self):
return [dev.dev for dev in self._bootdevs]
- def _set_bootorder(self, newdevs):
+
+ @bootorder.setter
+ def bootorder(self, newdevs):
for dev in self._bootdevs:
self.remove_child(dev)
for d in newdevs:
dev = self._bootdevs.add_new()
dev.dev = d
- _bootdevs = XMLChildProperty(_BootDevice)
- bootorder = property(_get_bootorder, _set_bootorder)
initargs = XMLChildProperty(_InitArg)
def set_initargs_string(self, argstring):
--
2.17.0
More information about the virt-tools-list
mailing list