+1 for me.

Best,
Regards

Daisy (Ô˹úÁ«)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol@cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces@redhat.com wrote on 2008-08-07 03:19:44:

> # HG changeset patch
> # User Kaitlin Rupert <karupert@us.ibm.com>
> # Date 1217542638 25200
> # Node ID 3f73022d65dc1385ba90a2de874c878c631e7aee
> # Parent  01e5197b144a873a55bb0c088fc29cd31a5a9b0e
> (#2) Add function to poll for a guest
>
> This function is a work around to deal with a stale data issue seen
> with libvirt on RHEL 5.x.
>
> -Updates:
>   -Changed name of polling function for clarity.
>
> Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
>
> diff -r 01e5197b144a -r 3f73022d65dc suites/libvirt-
> cim/lib/XenKvmLib/common_util.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py   Wed Aug 06
> 09:15:45 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py   Thu Jul 31
> 15:17:18 2008 -0700
> @@ -33,10 +33,12 @@
>  from pywbem.cim_obj import CIMInstanceName
>  from XenKvmLib.devices import CIM_Instance
>  from XenKvmLib.classes import get_typed_class
> -from CimTest.Globals import logger, log_param, CIM_ERROR_ENUMERATE
> +from CimTest.Globals import logger, log_param, CIM_ERROR_ENUMERATE, \
> +                            CIM_ERROR_GETINSTANCE
>  from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> -from VirtLib.live import diskpool_list, virsh_version, net_list
> +from VirtLib.live import diskpool_list, virsh_version, net_list, domain_list
>  from XenKvmLib.vxml import PoolXML, NetXML
> +from XenKvmLib.enumclass import getInstance
>  
>  test_dpath = "foo"
>  disk_file = '/etc/libvirt/diskpool.conf'
> @@ -57,7 +59,7 @@
>              return (1, cs)
>  
>      except Exception, detail:
> -        logger.error(Globals.CIM_ERROR_GETINSTANCE,
> +        logger.error(CIM_ERROR_GETINSTANCE,
>                       get_typed_class(virt, 'ComputerSystem'))
>          logger.error("Exception: %s", detail)
>          return (1, cs)
> @@ -397,3 +399,18 @@
>  
>      return PASS
>  
> +def libvirt_cached_data_poll(ip, virt, dom_name):
> +    cs = None
> +
> +    dom_list = domain_list(ip, virt)
> +    if dom_name in dom_list:
> +        timeout = 10
> +
> +        for i in range(0, timeout):
> +            rc, cs = get_cs_instance(dom_name, ip, virt)
> +            if rc == 0:
> +                return cs
> +
> +            sleep(1)
> +            
> +    return cs
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim