[PATCH] [TEST] Add PoolXML class for creating a virtual pool in vxml.py

# HG changeset patch # User Guolian Yun <yunguol@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@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"""

+1 for me. But can we also add pool-destroy to the file_arg_cmds list ? Thanks and Regards, Deepti. yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@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@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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@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@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')
Also , creation of the pool works fine without the source tags.
+ 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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Deepti B Kalakeri wrote:
yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@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@us.ibm.com>
Please sign with your DCO, not mine.
+ + 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')
Also , creation of the pool works fine without the source tags.
I source is needed for some kind of pools, such as iscsi pools. However, for dir type storage pools, agreed: you don't need the source tag. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Deepti B Kalakeri
-
Kaitlin Rupert
-
yunguol@cn.ibm.com