# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1243321084 25200
# Node ID 502f6364a823ebfc05748661625765028c339bb6
# Parent ecdbd16fefe8d7bdf82f85a74d66a312ab1c52e0
[TEST] Modifying vxml.py to accomadate DiskPool support.
Tested with KVM on F10 with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r ecdbd16fefe8 -r 502f6364a823 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon May 25 23:55:43 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon May 25 23:58:04 2009 -0700
@@ -293,7 +293,7 @@
class PoolXML(Virsh, XMLClass):
def __init__(self, server, poolname=const.default_pool_name,
- virt='xen'):
+ virt='xen', is_new_pool=True):
XMLClass.__init__(self)
if virt == 'XenFV':
@@ -302,6 +302,17 @@
self.pool_name = poolname
self.server = server
+ if is_new_pool is False:
+ cmd = "virsh pool-dumpxml %s" % self.pool_name
+ s, disk_xml = utils.run_remote(server, cmd)
+ if s != 0:
+ logger.error("Encounter error dump netxml")
+ return None
+ else:
+ self.xml_string = disk_xml
+ self.xdoc = minidom.parseString(self.xml_string)
+ return
+
pool = self.add_sub_node(self.xdoc, 'pool', type='dir')
self.add_sub_node(pool, 'name', self.pool_name)
target = self.add_sub_node(pool, 'target')
@@ -313,10 +324,19 @@
def destroy_vpool(self):
return self.run(self.server, 'pool-destroy', self.pool_name)
+ def undefine_vpool(self):
+ return self.run(self.server, 'pool-undefine', self.pool_name)
+
def xml_get_diskpool_name(self):
dpoolname = self.get_value_xpath('/pool/name')
return dpoolname
+ def xml_get_pool_attr_list(self):
+ pool_attr_list = []
+ poolpath = self.get_value_xpath('/pool/target/path')
+ pool_attr_list.append(poolpath)
+
+ return pool_attr_list
class VirtXML(Virsh, XMLClass):
"""Base class for all XML generation &
operation"""