[Libvirt-cim] [PATCH] [TEST] Update tests to reflect computersystem.py changes

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Sep 3 00:49:42 UTC 2008


> diff -r 946fd46b9686 -r 1269f456c0fe suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py
> --- a/suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/HostedDependency/03_enabledstate.py	Sun Aug 31 21:50:53 2008 -0700
> @@ -34,10 +34,9 @@
>  from time import sleep
>  from VirtLib import utils
>  from XenKvmLib import vxml
> -from XenKvmLib import computersystem 
>  from XenKvmLib import assoc
>  from XenKvmLib.common_util import get_host_info
> -from XenKvmLib.classes import get_class_basename
> +from XenKvmLib.classes import get_class_basename, get_typed_class
>  from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORS, \
>  CIM_ERROR_GETINSTANCE
>  from CimTest.Globals import do_main
> @@ -70,7 +69,7 @@
>      try:
>          for i in range(1, (timeout + 1)):
>              sleep(1)
> -            cs = computersystem.get_cs_class(virt)
> +            cs = get_typed_class(virt, 'ComputerSystem')

You need to use a getInstance() call here instead.

>              dom_cs = cs(server, name=test_dom)
>              if dom_cs.EnabledState == "" or dom_cs.CreationClassName == "" or \
>                 dom_cs.Name == "" or  dom_cs.RequestedState == "":
> diff -r 946fd46b9686 -r 1269f456c0fe suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py
> --- a/suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/SystemDevice/02_reverse.py	Sun Aug 31 21:50:53 2008 -0700
> @@ -27,7 +27,6 @@
>  import sys
>  from VirtLib import utils
>  from XenKvmLib import vxml
> -from XenKvmLib import computersystem
>  from XenKvmLib import assoc
>  from XenKvmLib import devices
>  from CimTest.Globals import logger, do_main
> @@ -37,6 +36,11 @@
> 
>  test_dom = "test_domain"
>  test_mac = "00:11:22:33:44:55"
> +
> +def system_of(server, iname):
> +    t = eval(iname["CreationClassName"])
> +
> +    return t(server, iname["Name"])
> 
>  @do_main(sup_types)
>  def main():
> @@ -92,7 +96,7 @@
>                  cxml.undefine(options.ip)
>                  return FAIL
> 
> -            system = computersystem.system_of(options.ip, systems[0])
> +            system = system_of(options.ip, systems[0])

You won't need the system_of() function at all - all this is doing is 
trying to get the CS instance, so a getInstance() call here should work.

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list