[Libvirt-cim] [PATCH 5 of 9] [TEST] Update HostSystem tests to expect an instance from get_host_info()

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Tue Nov 18 14:36:09 UTC 2008



Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1226705450 28800
> # Node ID 5466028a80608d44d61b06c3e38d5ef395cad169
> # Parent  59a6bdb3083be965c9959447b117efd57bd29e9d
> [TEST] Update HostSystem tests to expect an instance from get_host_info().
>
> Also remove XFAILs as these tests should pass now.
>
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>
> diff -r 59a6bdb3083b -r 5466028a8060 suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
> --- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py	Fri Nov 14 15:30:50 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py	Fri Nov 14 15:30:50 2008 -0800
> @@ -55,13 +55,12 @@
>  from XenKvmLib.common_util import get_host_info
>  from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES, \
>  CIM_ERROR_ASSOCIATORS
> -from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> +from CimTest.ReturnCodes import PASS, FAIL
>  from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
>  verify_diskrasd_values, verify_memrasd_values, verify_displayrasd_values, \
>  rasd_init_list
>
>  sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
> -bug_sblim = '00007'
>
>  test_dom    = "CrossClass_GuestDom"
>  test_vcpus  = 1
> @@ -125,11 +124,8 @@
>                                       CreationClassName = cn,
>                                       Name = name)
>          if len(assoc_info) < 1:
> -            if cn == 'Linux_ComputerSystem':
> -                status = XFAIL_RC(bug_sblim)
> -            else:
> -                logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
> -                status = FAIL
> +            logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
> +            status = FAIL
>
>      except Exception, detail:
>          print_err(CIM_ERROR_ASSOCIATORNAMES, detail, cn)
> @@ -199,16 +195,17 @@
>      options = main.options
>      server = options.ip
>      status = PASS
> -    status, host_name, classname = get_host_info(server, options.virt)
> +    status, host_inst = get_host_info(server, options.virt)
>      if status != PASS:
>          return status
> +    
>      status, vsxml = setup_env(server, options.virt)
>      if status != PASS or vsxml == None:
>          return status
> -    cn   = classname
> +    cn   = host_inst.CreationClassName 
>      an   = get_typed_class(options.virt, 'HostedDependency')
>      qcn  = get_typed_class(options.virt, 'ComputerSystem')
> -    name = host_name
> +    name = host_inst.Name
>      status, cs_assoc_info = get_assoc_info(server, cn, an, qcn, name, vsxml)
>      if status != PASS or len(cs_assoc_info) == 0:
>          return status
> diff -r 59a6bdb3083b -r 5466028a8060 suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py
>   
This tc fails with the sblim-base-provider installed:
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: FAIL
ERROR - 'Xen_HostedResourcePool' has returned 0 instances, expected 4 
instances
CIM_ERR_INVALID_PARAMETER: Xen_HostedResourcePool
--------------------------------------------------------------------

> --- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py	Fri Nov 14 15:30:50 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py	Fri Nov 14 15:30:50 2008 -0800
> @@ -47,7 +47,7 @@
>  from XenKvmLib.classes import get_typed_class
>  from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES
>  from XenKvmLib.const import do_main
> -from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> +from CimTest.ReturnCodes import PASS, FAIL
>  from XenKvmLib.test_xml import testxml
>  from XenKvmLib.test_doms import destroy_and_undefine_all
>  from XenKvmLib.const import get_provider_version
> @@ -55,7 +55,6 @@
>  sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
>  test_dom = "domgst_test"
>  test_vcpus = 1
> -bug_sblim='00007'
>  libvirt_rasd_template_changes = 707
>
>  def setup_env(server, virt="Xen"):
> @@ -102,8 +101,8 @@
>      host = live.hostname(server)
>
>      try:
> -        status, hostname, clsname = get_host_info(server, virt)
> -        if hostname != host:
> +        status, host_inst = get_host_info(server, virt)
> +        if host_inst.Name != host:
>              status = FAIL
>              logger.error("Hostname mismatch") 
>
> @@ -111,7 +110,7 @@
>          logger.error("Exception in %s : %s" % (cn, detail))
>          status = FAIL 
>
> -    return status, hostname, clsname
> +    return status, host_inst.Name, host_inst.CreationClassName 
>
>  def get_hostrespool(server, hostsys, clsname, virt="Xen"):
>      an1 = get_typed_class(virt, "HostedResourcePool")
> @@ -132,12 +131,9 @@
>                                   CreationClassName = clsname,
>                                   Name = hostsys)
>          if len(assoc_info) < 4:
> -            if clsname == 'Linux_ComputerSystem':
> -                return XFAIL_RC(bug_sblim), devpool
> -            else:
> -                logger.error("'%s' has returned %i instances, expected 4"
> -                             " instances", an1, len(assoc_info))
> -                return FAIL, devpool
> +            logger.error("'%s' has returned %i instances, expected 4"
> +                         " instances", an1, len(assoc_info))
> +            return FAIL, devpool
>
>          for inst in assoc_info:
>              for a, val in ccnlist.items():
> diff -r 59a6bdb3083b -r 5466028a8060 suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py
> --- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py	Fri Nov 14 15:30:50 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py	Fri Nov 14 15:30:50 2008 -0800
>   
This tc fails with the sblim-base-provider installed:
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: FAIL
ERROR - DEBUG host_name is elm3b43.beaverton.ibm.com
ERROR - Xen_HostedResourcePool returned 0 Device Pool objects
CIM_ERR_INVALID_PARAMETER: Xen_HostedResourcePool
--------------------------------------------------------------------

> @@ -56,7 +56,7 @@
>  from XenKvmLib.assoc import AssociatorNames, Associators
>  from XenKvmLib.common_util import get_host_info
>  from XenKvmLib.classes import get_typed_class
> -from CimTest.ReturnCodes import PASS, FAIL, SKIP, XFAIL_RC
> +from CimTest.ReturnCodes import PASS, FAIL, SKIP
>  from XenKvmLib.test_doms import destroy_and_undefine_all
>  from XenKvmLib.logicaldevices import verify_device_values
>
> @@ -66,7 +66,6 @@
>  test_mac   = "00:11:22:33:44:aa"
>  test_mem   = 128 
>  test_vcpus = 1 
> -bug_sblim='00007'
>
>  def print_err(err, detail, cn):
>      logger.error(err % cn)
> @@ -161,12 +160,9 @@
>                                       CreationClassName=host_cn,
>                                       Name = hostname)
>          if len(assoc_info) < 1:
> -            if host_cn == 'Linux_ComputerSystem':
> -               return XFAIL_RC(bug_sblim), assoc_info
> -            else:
> -               logger.error("%s returned %i %s objects",
> -                             an, len(assoc_info), qcn)
> -               return FAIL, assoc_info
> +            logger.error("%s returned %i %s objects",
> +                         an, len(assoc_info), qcn)
> +            return FAIL, assoc_info
>
>      except Exception, detail:
>          print_err(CIM_ERROR_ASSOCIATORNAMES, detail, host_cn)
> @@ -213,7 +209,7 @@
>      server = options.ip
>      virt=options.virt
>      # Get the host info 
> -    status, host_name, classname = get_host_info(server, virt)
> +    status, host_inst = get_host_info(server, virt)
>      if status != PASS:
>          return status
>
> @@ -239,7 +235,8 @@
>      net_name = vsxml.xml_get_net_network()
>
>      # Get the hostedResourcePool info first
> -    host_cn  = classname
> +    host_name = host_inst.Name
> +    host_cn  = host_inst.CreationClassName 
>      an  = get_typed_class(virt, "HostedResourcePool")
>      qcn = "Device Pool"
>      logger.error("DEBUG host_name is %s", host_name)
> diff -r 59a6bdb3083b -r 5466028a8060 suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py
> --- a/suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py	Fri Nov 14 15:30:50 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py	Fri Nov 14 15:30:50 2008 -0800
> @@ -78,7 +78,7 @@
>  from XenKvmLib.common_util import get_host_info, try_getinstance
>  from XenKvmLib.classes import get_typed_class
>  from optparse import OptionParser
> -from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
> +from CimTest.ReturnCodes import PASS, FAIL, SKIP
>  from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
>  from XenKvmLib.const import do_main
>
> @@ -92,7 +92,6 @@
>                                      'desc' : "No such instance (Name)" }
>                }
>
> -bug_sblim='00007'
>
>  @do_main(sup_types)
>  def main():
> @@ -102,9 +101,16 @@
>      if options.virt == "XenFV":
>          options.virt = 'Xen'
>
> -    status, host_name, classname = get_host_info(options.ip, options.virt)
> +    status, host_inst = get_host_info(options.ip, options.virt)
>      if status != PASS:
>          return status
> +
> +    classname = host_inst.CreationClassName
> +    host_name = host_inst.CreationClassName
> +
> +    #Test calls GetInstance() - no need to test GetInstance() of SBLIM providers
> +    if (classname == "Linux_ComputerSystem"):
> +        return SKIP
>
>      conn = assoc.myWBEMConnection('http://%s' % options.ip, 
>                                    (CIM_USER, CIM_PASS), CIM_NS)
> @@ -116,11 +122,8 @@
>                                  expr_values=expr_values['invalid_ccname'], 
>                                  bug_no="")
>      if ret_value != PASS:
> -        if classname == 'Linux_ComputerSystem':
> -            return XFAIL_RC(bug_sblim)
> -        else:
> -            logger.error("------ FAILED: Invalid CCName Key Name.------")
> -            return ret_value
> +        logger.error("------ FAILED: Invalid CCName Key Name.------")
> +        return ret_value
>
>      # 2) Test by passing Invalid CCName Key Value
>      field = 'INVALID_CCName_KeyValue'
> @@ -129,11 +132,8 @@
>                                  expr_values=expr_values['invalid_ccname'], 
>                                  bug_no="")
>      if ret_value != PASS:
> -        if classname == 'Linux_ComputerSystem':
> -            return XFAIL_RC(bug_sblim)
> -        else:
> -            logger.error("------ FAILED: Invalid CCName Key Value.------")
> -            return ret_value
> +        logger.error("------ FAILED: Invalid CCName Key Value.------")
> +        return ret_value
>
>      # 3) Test by giving Invalid Name Key Name
>      field = 'INVALID_Name_KeyName'
> @@ -142,11 +142,8 @@
>                                  expr_values=expr_values['invalid_name'], 
>                                  bug_no="")
>      if ret_value != PASS:
> -        if classname == 'Linux_ComputerSystem':
> -            return XFAIL_RC(bug_sblim)
> -        else:
> -            logger.error("------ FAILED: Invalid Name Key Name.------")
> -            return ret_value
> +        logger.error("------ FAILED: Invalid Name Key Name.------")
> +        return ret_value
>
>      # 4) Test by passing Invalid Name Key Value
>      field = 'INVALID_Name_KeyValue'
> @@ -155,11 +152,8 @@
>                                  expr_values=expr_values['invalid_name'], 
>                                  bug_no="")
>      if ret_value != PASS:
> -        if classname == 'Linux_ComputerSystem':
> -            return XFAIL_RC(bug_sblim)
> -        else:
> -            logger.error("------ FAILED: Invalid Name Key Value.------")
> -            return ret_value
> +        logger.error("------ FAILED: Invalid Name Key Value.------")
> +        return ret_value
>
>      return PASS
>
> diff -r 59a6bdb3083b -r 5466028a8060 suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py
> --- a/suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py	Fri Nov 14 15:30:50 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/HostSystem/06_hs_to_vsms.py	Fri Nov 14 15:30:50 2008 -0800
> @@ -99,9 +99,12 @@
>
>
>  def get_vsms_info():
> -    status, host_name, classname = get_host_info(server, virt)
> +    status, host_inst = get_host_info(server, virt)
>      if status != PASS:
>          return status, []
> +
> +    classname = host_inst.CreationClassName
> +    host_name = host_inst.Name
>      status, service_assoc_info = get_assocnames_info(server, classname, 
>                                                       assoc_name, req_cn, host_name)
>      if status != PASS or len(service_assoc_info) == 0:
>
> _______________________________________________
> 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