[Libvirt-cim] [PATCH] [TEST] (#2) Improve enum volumes

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Tue Apr 21 06:03:47 UTC 2009



Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1240002683 25200
> # Node ID eea660ff3ad6e589f76bf17b3697d30465e54398
> # Parent  ced161a8198115797a6036f3f22e02d234439a76
> [TEST] (#2) Improve enum volumes
>
> The providers don't return a template RASD for volumes that libvirt is
> unable to get volume info for.  So the testsuite needs to do the same.
>   
The information that libvirt virsh pool-list is returning is not 
completely correct:
For ex:

virsh -c qemu:///system vol-list cimtest-diskpoolName Path
-----------------------------------------
.X0-lock /tmp/.X0-lock
cimtest.uuid /tmp/cimtest.uuid
default-kvm-dimage /tmp/default-kvm-dimage
tmpnsIv8q /tmp/tmpnsIv8q

The last pool information tmpnsIv8q does not seem to exist on the 
machine, hence when I ran the HostSystem/03_hs_to_settdefcap.py it 
failed with the following error:

-------------------------------------------------------------------------------------------------------------------------------
ERROR - 'KVM_SettingsDefineCapabilities' returned 0 RASD objects instead 
of 16
CIM_ERR_INVALID_CLASS: Linux_ComputerSystem
CIM_ERR_FAILED: Unable to get volume information: cannot open volume 
'/tmp/tmpnsIv8q': No such file or directory
-------------------------------------------------------------------------------------------------------------------------------

The test case passed after I created the file /tmp/tmpnsIv8q.
I am not sure if this is the limitation from libvirt side or if its a 
feature with libvirt.
Anyways +1 for these changes.
> Also, don't use a hardcoded disk pool name - use the default value from const.py
>
> Updates:
>   -Remove test code
>   -Allow caller to specify pool name, or use default pool name if one isn't
>    specified
>
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>
> diff -r ced161a81981 -r eea660ff3ad6 suites/libvirt-cim/lib/XenKvmLib/pool.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py	Wed Apr 15 20:19:31 2009 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py	Fri Apr 17 14:11:23 2009 -0700
> @@ -24,7 +24,7 @@
>  from CimTest.Globals import logger
>  from CimTest.ReturnCodes import PASS, FAIL
>  from XenKvmLib.classes import get_typed_class
> -from XenKvmLib.const import get_provider_version 
> +from XenKvmLib.const import get_provider_version, default_pool_name 
>  from XenKvmLib.enumclass import EnumInstances
>  from VirtLib.utils import run_remote
>  from XenKvmLib.xm_virt_util import virt2uri
> @@ -80,16 +80,20 @@
>
>      return pool_insts, PASS
>
> -def enum_volumes(virt, server):
> +def enum_volumes(virt, server, pooln=default_pool_name):
>      volume = 0
>      cmd = "virsh -c %s vol-list %s | sed -e '1,2 d' -e '$ d'" % \
> -          (virt2uri(virt), 'cimtest-diskpool')
> +          (virt2uri(virt), default_pool_name)
>      ret, out = run_remote(server ,cmd)
>      if ret != 0:
>          return None
>      lines = out.split("\n")
>      for line in lines:
> -        volume = volume + 1
> +        vol = line.split()[0]   
> +        cmd = "virsh -c %s vol-info --pool %s %s" % (virt2uri(virt), pooln, vol)
> +        ret, out = run_remote(server ,cmd)
> +        if ret == 0:
> +            volume = volume + 1
>
>      return volume
>
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>   

-- 
Thanks and Regards,
Deepti B. Kalakeri
IBM Linux Technology Center
deeptik at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list