+1 for me.
But can we also add pool-destroy to the file_arg_cmds list ?
Thanks and Regards,
Deepti.
yunguol(a)cn.ibm.com wrote:
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1210779243 -28800
# Node ID dcb1f04780e641973d1070440bc6f50fac2e9831
# Parent cdcf642c493a548d2deb499f223bb9a1f414cb3c
[TEST] Add PoolXML class for creating a virtual pool in vxml.py
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r cdcf642c493a -r dcb1f04780e6 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Mon May 12 03:23:12 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Wed May 14 23:34:03 2008 +0800
@@ -37,6 +37,9 @@
default_bridge_name = 'testbridge'
default_network_name = 'default-net'
+#vxml.PoolXML
+default_pool_name = 'testpool'
+
# vxml.VirtXML
default_domname = 'domU1'
default_memory = 128
diff -r cdcf642c493a -r dcb1f04780e6 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon May 12 03:23:12 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed May 14 23:34:03 2008 +0800
@@ -143,7 +143,7 @@
self.vuri = 'qemu:///system'
def run(self, ip, vcmd, param):
- file_arg_cmds = ['define', 'create', 'net-create']
+ file_arg_cmds = ['define', 'create', 'net-create',
'pool-create']
if vcmd in file_arg_cmds:
ntf = tempfile.NamedTemporaryFile('w')
ntf.write(param)
@@ -211,6 +211,27 @@
def create_vnet(self):
return self.run(self.server, 'net-create', self.xml_string)
+class PoolXML(Virsh, XMLClass):
+
+ def __init__(self, server, poolname=const.default_pool_name,
+ virt='xen'):
+
+ XMLClass.__init__(self)
+ if virt == 'XenFV':
+ virt = 'xen'
+ Virsh.__init__(self, str(virt).lower())
+ self.pool_name = poolname
+ self.server = server
+
+ pool = self.add_sub_node(self.xdoc, 'pool', type='dir')
+ self.add_sub_node(pool, 'name', self.pool_name)
+ source = self.add_sub_node(pool, 'source')
+ self.add_sub_node(source, 'device', path='/tmp')
+ target = self.add_sub_node(pool, 'target')
+ self.add_sub_node(target, 'path', '/tmp')
+
+ def create_vpool(self):
+ return self.run(self.server, 'pool-create', self.xml_string)
class VirtXML(Virsh, XMLClass):
"""Base class for all XML generation &
operation"""
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim