[Libvirt-cim] [PATCH] [TEST] Update all tc to call new GetInstance

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Mon Oct 20 13:21:01 UTC 2008


+1 for me.

yunguol at cn.ibm.com wrote:
> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1224469713 25200
> # Node ID 0ebf9d140faab8bee8802ecf5f2de8a30286ff0c
> # Parent  a3d9c0a81c27471418993b7c8f907f0b95f79e63
> [TEST] Update all tc to call new GetInstance
>
> Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>
>
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -73,12 +73,12 @@ def main():
>          if not ret :
>              logger.error("ERROR: VS %s was not defined" % test_dom)
>              return status 
> -
> +        cs_class = get_typed_class(options.virt, 'ComputerSystem')
>          keys = {
>                  'Name' : test_dom,
> -                'CreationClassName' : get_typed_class(options.virt, 'ComputerSystem')
> +                'CreationClassName' : cs_class
>                 }
> -        cs = enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
> +        cs = enumclass.GetInstance(options.ip, cs_class, keys)
>
>          if cs.Name == test_dom:
>              from_State =  cs.EnabledState
> @@ -101,7 +101,7 @@ def main():
>
>  #Get the value of the EnabledState property and RequestedState property.
>      try:
> -        cs= enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
> +        cs= enumclass.GetInstance(options.ip, cs_class, keys)
>          if cs.Name == test_dom:
>              to_RequestedState = cs.RequestedState
>              enabledState = cs.EnabledState
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py
> --- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -45,7 +45,7 @@ from XenKvmLib.assoc import Associators
>  from XenKvmLib.assoc import Associators
>  from XenKvmLib.test_doms import destroy_and_undefine_all 
>  from XenKvmLib import devices
> -from XenKvmLib.enumclass import getInstance 
> +from XenKvmLib.enumclass import GetInstance 
>  from CimTest.Globals import CIM_ERROR_ASSOCIATORS, CIM_ERROR_GETINSTANCE
>  from XenKvmLib.vxml import get_class
>  from XenKvmLib.classes import get_typed_class
> @@ -61,16 +61,17 @@ test_vcpus = 1
>  test_vcpus = 1 
>
>  def get_inst(server, virt, cn, key_list):
> +    cn_name = get_typed_class(virt, cn)
>      inst = None 
>      try:
> -        inst = getInstance(server, cn, key_list, virt)
> +        inst = GetInstance(server, cn_name, key_list)
>
>      except Exception, details:
>          logger.error("Exception %s" % details)
>          return None 
>
>      if inst is None:
> -        logger.error("Expected at least one %s instance" % cn)
> +        logger.error("Expected at least one %s instance" % cn_name)
>          return None 
>
>      return inst 
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py
> --- a/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -34,7 +34,7 @@ from CimTest.Globals import logger, CIM_
>                              CIM_ERROR_ASSOCIATORNAMES
>  from XenKvmLib.const import do_main
>  from CimTest.ReturnCodes import PASS, FAIL, SKIP
> -from XenKvmLib.enumclass import getInstance
> +from XenKvmLib.enumclass import GetInstance
>
>  sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
>  test_dom  = "dom_elecap"
> @@ -94,8 +94,7 @@ def verify_service(inst_list, ip, virt, 
>                'SystemCreationClassName' : host_ccn
>             }   
>      try:
> -        basename = get_class_basename(ser_cn)
> -        service = getInstance(ip, basename, keys, virt)
> +        service = GetInstance(ip, ser_cn, keys)
>      except Exception, detail:
>          logger.error(CIM_ERROR_GETINSTANCE, ser_cn)
>          logger.error("Exeption : %s", detail)
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
> --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -73,13 +73,11 @@ def setup_env(server, virt):
>      return PASS, vsxml, test_disk
>
>  def get_instance(server, pool, list, virt='Xen'):
> +    pool_cn = get_typed_class(virt, pool)
>      try:
> -        inst = enumclass.getInstance(server,
> -                                     pool,
> -                                     list,
> -                                     virt)
> +        inst = enumclass.GetInstance(server, pool_cn, list)
>      except Exception:
> -        logger.error(Globals.CIM_ERROR_GETINSTANCE  % pool)
> +        logger.error(Globals.CIM_ERROR_GETINSTANCE  % pool_cn)
>          return FAIL, inst
>    
>      return PASS, inst
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
> --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -105,7 +105,7 @@ def get_rasd_instance(server, virt, key_
>  def get_rasd_instance(server, virt, key_list, cn):
>      inst = None 
>      try:
> -        inst = enumclass.getInstance(server, cn, key_list, virt)
> +        inst = enumclass.GetInstance(server, cn, key_list)
>      except Exception, details:
>          logger.error(Globals.CIM_ERROR_GETINSTANCE, cn)
>          logger.error("Exception details: %s", details)
> diff -r a3d9c0a81c27 -r 0ebf9d140faa suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
> --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py	Wed Oct 15 19:13:10 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py	Sun Oct 19 19:28:33 2008 -0700
> @@ -78,7 +78,7 @@ def get_or_bail(virt, ip, id, pool_class
>      """
>      key_list = { 'InstanceID' : id } 
>      try:
> -        instance = enumclass.getInstance(ip, pool_class, key_list, virt)
> +        instance = enumclass.GetInstance(ip, pool_class, key_list)
>      except Exception, detail:
>          logger.error(CIM_ERROR_GETINSTANCE, '%s' % pool_class)
>          logger.error("Exception: %s", detail)
> @@ -123,8 +123,7 @@ def init_list(virt, pool):
>
>  def get_pool_info(virt, server, devid, poolname=""):
>          pool_cname = get_typed_class(virt, poolname)
> -        pool_cn = eval("enumclass." + pool_cname)
> -        return get_or_bail(virt, server, id=devid, pool_class=pool_cn)
> +        return get_or_bail(virt, server, id=devid, pool_class=pool_cname)
>
>  def get_pool_details(virt, server):  
>      dpool = npool  = mpool  = ppool = None
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>   




More information about the Libvirt-cim mailing list