[Libvirt-cim] [PATCH] [TEST] create a virtual storage pool in vxml.py

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Apr 29 19:24:38 UTC 2008


Guo Lian Yun wrote:
> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1209458122 25200
> # Node ID 144b49e7504511817693b3f3e78c7905e8aed140
> # Parent  2b83c1992dfc44573ba0c00729e36311355807ad
> [TEST] create a virtual storage pool in vxml.py
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r 2b83c1992dfc -r 144b49e75045 suites/libvirt-cim/lib/XenKvmLib/vxml.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py	Sun Apr 27 19:22:03 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py	Tue Apr 29 01:35:22 2008 -0700
> @@ -44,6 +44,7 @@ from CimTest.Globals import logger, CIM_
>  from CimTest.Globals import logger, CIM_IP, CIM_PORT, CIM_NS, CIM_USER, CIM_PASS
>  from CimTest.ReturnCodes import SKIP
>  from XenKvmLib.classes import virt_types, get_typed_class
> +from XenKvmLib.const import CIM_REV
> 
>  class XMLClass:
>      xml_string = ""
> @@ -536,6 +537,15 @@ class KVMXML(VirtXML):
>          self.add_sub_node(interface, 'mac', address=net_mac)
>          if net_type == 'bridge':
>              self.set_vbridge(CIM_IP)    
> +
> +        if CIM_REV > 496:
> +            pool = self.add_sub_node(devices, 'pool', type='disk')
> +            self.add_sub_node(pool, 'name', 'test')
> +            source = self.add_sub_node(pool, 'source')
> +            self.add_sub_node(source, 'device', path='/dev/sda')
> +            self.add_sub_node(source, 'dir', path='/dev')
> +            target = self.add_sub_node(pool, 'target')
> +            self.add_sub_node(target, 'path', '/dev')

This modifies the XML of the guest.  The guest already has the devices 
set.  This is what it looks like when you print the XML:

         <devices>
                 <emulator>
                         /usr/bin/qemu
                 </emulator>
                 <disk device="disk" type="file">
                         <source file="/tmp/default-kvm-dimage"/>
                         <target dev="hda"/>
                 </disk>
                 <interface type="bridge">
                         <mac address="11:22:33:aa:bb:cc"/>
                         <source bridge="testbridge"/>
                 </interface>
         </devices>

So, the guest already has a disk device.  You'll need to create a 
virtual storage pool for /tmp.
-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list