[virt-tools-list] [virt-manager] [PATCH 1/2] Keep the value of filesystem/source when attribute is changed

Radostin Stoyanov rstoyanov1 at gmail.com
Fri Jun 16 10:32:46 UTC 2017


When the attribute of filesystem/source is changed the old value is
not assigned to the new attribute.
---
 virtinst/devicefilesystem.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/virtinst/devicefilesystem.py b/virtinst/devicefilesystem.py
index 951b716..be8f841 100644
--- a/virtinst/devicefilesystem.py
+++ b/virtinst/devicefilesystem.py
@@ -54,7 +54,7 @@ class VirtualFilesystem(VirtualDevice):
         DRIVER_DEFAULT]
 
 
-    type = XMLProperty("./@type",
+    _type_prop = XMLProperty("./@type",
                        default_cb=lambda s: None,
                        default_name=TYPE_DEFAULT)
     accessmode = XMLProperty("./@accessmode",
@@ -111,6 +111,15 @@ class VirtualFilesystem(VirtualDevice):
         return setattr(self, self._type_to_source_prop(), val)
     source = property(_get_source, _set_source)
 
+    def _get_type(self):
+        return getattr(self, '_type_prop')
+    def _set_type(self, val):
+        source_value = self.source
+        new_type = setattr(self, '_type_prop', val)
+        self.source = source_value
+        return new_type
+    type = property(_get_type, _set_type)
+
     def set_defaults(self, guest):
         ignore = guest
 
-- 
2.9.4




More information about the virt-tools-list mailing list