diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index e940ebd8..56c9fbcd 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -71,6 +71,9 @@ class Volume(object): self.size = size self.volume_type = volume_type + def __xml__(self): + return lxml.etree.Element('volume', **self.config) + @property def config(self): ''' return config data for serialization to qubes.xml ''' diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 4a77b181..e0932292 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -493,8 +493,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): if hasattr(self, 'volumes'): volume_config_node = lxml.etree.Element('volume-config') for volume in self.volumes.values(): - volume_node = lxml.etree.Element('volume', **volume.config) - volume_config_node.append(volume_node) + volume_config_node.append(volume.__xml__()) element.append(volume_config_node)