Move volume xml config from QubesVM to Volume

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-04-22 14:29:30 +02:00
parent 2e28849c90
commit d7ff4b9057
2 changed files with 4 additions and 2 deletions

View File

@ -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 '''

View File

@ -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)