From d7ff4b90577c6da516dd3a73fc28a63c36fec09f Mon Sep 17 00:00:00 2001 From: Bahtiar `kalkin-` Gadimov Date: Fri, 22 Apr 2016 14:29:30 +0200 Subject: [PATCH] Move volume xml config from QubesVM to Volume --- qubes/storage/__init__.py | 3 +++ qubes/vm/qubesvm.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) 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)