diff --git a/qubes/__init__.py b/qubes/__init__.py index 22fe7c98..5d35e970 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -1319,7 +1319,13 @@ class Qubes(PropertyHolder): element = lxml.etree.Element('qubes') element.append(self.xml_labels()) - element.append(self.xml_pool_configs()) + + pools_xml = lxml.etree.Element('pools') + for pool in self.pools.values(): + pools_xml.append(pool.__xml__()) + + element.append(pools_xml) + element.append(self.xml_properties()) domains = lxml.etree.Element('domains') @@ -1422,15 +1428,6 @@ class Qubes(PropertyHolder): labels.append(label.__xml__()) return labels - def xml_pool_configs(self): - """ Helper for converting pools config to xml """ - pools_xml = lxml.etree.Element('pools') - for pool in self.pools.values(): - p = lxml.etree.Element('pool', **pool.config) - pools_xml.append(p) - - return pools_xml - def get_vm_class(self, clsname): '''Find the class for a domain. diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index a1dbb0f9..e940ebd8 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -37,6 +37,8 @@ import qubes.exc import qubes.utils from qubes.devices import BlockDevice +import lxml.etree + STORAGE_ENTRY_POINT = 'qubes.storage' @@ -231,6 +233,9 @@ class Pool(object): self.name = name kwargs['name'] = self.name + def __xml__(self): + return lxml.etree.Element('pool', **self.config) + def create(self, volume, source_volume): ''' Create the given volume on disk or copy from provided `source_volume`.