Move pool xml config from Qubes to Pool

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-04-22 14:16:41 +02:00
parent 49b4951389
commit 2e28849c90
2 changed files with 12 additions and 10 deletions

View File

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

View File

@ -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`.