[Libvirt-cim] [PATCH 2 of 2] (#2) Update ElementConforms 02 to use check_virsh_poll() work around

Guo Lian Yun yunguol at cn.ibm.com
Mon Aug 11 06:30:21 UTC 2008


+1 for me.

Best,
Regards

Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol at cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces at redhat.com wrote on 2008-08-07 03:19:45:

> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1217542648 25200
> # Node ID 40afbdebb121e53b37e3a8d357afa8de86ff09cb
> # Parent  3f73022d65dc1385ba90a2de874c878c631e7aee
> (#2) Update ElementConforms 02 to use check_virsh_poll() work around.
> 
> Also clean this test case some.
> 
> Updates:
>   -Fix log messages so that they print the proper class prefix
>   -Updated poll function name.
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r 3f73022d65dc -r 40afbdebb121 suites/libvirt-
> cim/cimtest/ElementConforms/02_reverse.py
> --- a/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py   Thu
> Jul 31 15:17:18 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py   Thu
> Jul 31 15:17:28 2008 -0700
> @@ -52,6 +52,7 @@
>  from XenKvmLib.vxml import XenXML, KVMXML, get_class
>  from XenKvmLib.classes import get_typed_class
>  from CimTest.ReturnCodes import PASS, FAIL
> +from XenKvmLib.common_util import libvirt_cached_data_poll, 
get_cs_instance 
> 
>  sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
> 
> @@ -96,51 +97,42 @@
> 
>      inst_list = []
> 
> +    rc, cs = get_cs_instance(test_dom, options.ip, options.virt)
> +    if rc != 0:
> +        sys = libvirt_cached_data_poll(options.ip, options.virt, 
test_dom)
> +        if sys is None:
> +            logger.error("Instance for %s not created" % test_dom)
> +            return FAIL 
> +
> +        inst_list.append(sys)
> +
>      try:
> -        cs_list = computersystem.enumerate(options.ip, options.virt)
> -        # The len should be atleast two, as the CS returns info
> -        # one regarding VS and the other one for Domain-0. 
> -        if len(cs_list) < 1:
> -            logger.error("ERROR: Wrong number of instances returned")
> -            return status
> -        for item in cs_list:
> -            if item.Name == test_dom:
> -                inst_list.append(item)
> -                break
> -
> -        if len(inst_list) != 1:
> -            logger.error("ERROR: Instance for %s not created" % 
test_dom)
> -            return status
> -
>          #Getting the hostname, to verify with the value returned bythe 
assoc.
>          host_sys = hostsystem.enumerate(options.ip, options.virt)
> 
>          if len(host_sys) < 1:
>              logger.error("ERROR: Enumerate returned 0 host instances")
> -            return status
> -        elif host_sys[0].Name == "":
> -            logger.error("ERROR: HostName seems to be empty")
> -            return status
> -        else:
> -            # Instance of the HostSystem
> -            inst_list.append(host_sys[0])
> -    except Exception , detail:
> -        logger.error("Exception: %s" % detail)
> -        return status
> +            return FAIL 
> +
> +        inst_list.append(host_sys[0])
> +
> +    except Exception, details:
> +        logger.error("Exception: %s" % details)
> +        return FAIL 
> 
>      prev_namespace = Globals.CIM_NS
>      Globals.CIM_NS = 'root/interop'
> 
>      try:
>          key_list = ["InstanceID"]
> -        proflist = enumclass.enumerate(options.ip, \
> -                                       "RegisteredProfile", \
> +        proflist = enumclass.enumerate(options.ip,
> +                                       "RegisteredProfile",
>                                          key_list,
>                                          options.virt)
> -    except Exception, detail:
> -        logger.error(CIM_ERROR_ENUMERATE, \
> -                             'RegisteredProfile')
> -        logger.error("Exception: %s", detail)
> +    except Exception, details:
> +        logger.error(CIM_ERROR_ENUMERATE, 
> +                     get_typed_class(options.virt, 
'RegisteredProfile')) 
> +        logger.error("Exception: %s", details)
>          return status
> 
>      Globals.CIM_NS = prev_namespace
> @@ -160,14 +152,16 @@
>                                        Name=name)
>              if len(profs) != 1:
>                  logger.error("ElementConformsToProfile assoc failed")
> -                return status 
> +                return FAIL
> 
>              status = verify_profile(profs[0], exp_list[cn])
>              if status != PASS:
>                  logger.error("Verification of profile instance failed")
> +                return FAIL
> 
>      except Exception, detail:
> -        logger.error(CIM_ERROR_ASSOCIATORS, 'RegisteredProfile')
> +        logger.error(CIM_ERROR_ASSOCIATORS, 
> +                     get_typed_class(options.virt, 
'RegisteredProfile'))
>          logger.error("Exception: %s", detail)
>          status = FAIL
> 
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080811/c4717bcc/attachment.htm>


More information about the Libvirt-cim mailing list