[Libvirt-cim] [PATCH] [TEST] Update CS to call enumclass.py instead of computersystem.py

Deepti B Kalakeri deeptik at linux.vnet.ibm.com
Tue Sep 2 10:59:26 UTC 2008


Tested the changes on KVM with current sources, with changeset:647
Please see my comments inline.

Thanks and Regards,
Deepti.

yunguol at cn.ibm.com wrote:
> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1220236263 25200
> # Node ID db9789b5145f4cb219d4fcdfaa242e346d8b9c4d
> # Parent  946fd46b96866adaab356876f9c8bbf937f0b3d6
> [TEST] Update CS to call enumclass.py instead of computersystem.py
>
> Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>
>
> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -24,7 +24,7 @@
>
>  import sys
>  from XenKvmLib.const import do_main
> -from XenKvmLib import computersystem
> +from XenKvmLib import enumclass
>  from VirtLib import live
>  from VirtLib import utils
>  from CimTest import Globals
> @@ -37,8 +37,9 @@
>      options = main.options 
>      status = PASS
>
> +    keys = ['Name', 'CreationClassName']
>      try:
> -        cs = computersystem.enumerate(options.ip, options.virt)
> +        cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
>          live_cs = live.domain_list(options.ip, options.virt)
>          for system in cs:
>              name = system.name
>   
+1 for the above changes.
Can you make the following changes as well.
1) Remove Globals.logger.error and use logger.error instead.
2) Need to initalise status=FAIL in the exception block otherwise it 
returns a PASS even when there is an exception in the tc.
> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -24,7 +24,7 @@
>
>  import sys
>  import pywbem
> -from XenKvmLib import computersystem
> +from XenKvmLib import enumclass
>  from VirtLib import live
>  from VirtLib import utils
>  from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
> @@ -49,9 +49,9 @@
>          return SKIP 
>
>      cn = "%s_ComputerSystem" % options.virt
> -
> +    keys = ['Name', 'CreationClassName']
>      try:
> -        cs = computersystem.enumerate(options.ip, options.virt)
> +        cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
>
>      except Exception, details:
>          logger.error(CIM_ERROR_ENUMERATE, cn)
>   
+ 1 for me
> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -27,7 +27,7 @@
>  # 26-Sep-2007
>
>  import sys
> -from XenKvmLib import computersystem
> +from XenKvmLib import enumclass
>  from XenKvmLib import vxml
>  from XenKvmLib.classes import get_typed_class
>  from VirtLib import utils
> @@ -48,9 +48,9 @@
>      if not rc:
>          Globals.logger.error(VIRSH_ERROR_DEFINE % test_dom)
>          return status
> -
> +    keys = ['Name', 'CreationClassName']
>      try:
> -        cs = computersystem.enumerate(options.ip, options.virt)
> +        cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
>          if len(cs) == 0:
>              raise Exception('No cs instance returned')
>          for dom in cs:
>   
+1 for me
> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -32,7 +32,7 @@
>  import sys
>  from time import sleep
>  from XenKvmLib import vxml
> -from XenKvmLib import computersystem
> +from XenKvmLib import enumclass
>  from CimTest import Globals
>  from XenKvmLib.classes import get_typed_class
>  from XenKvmLib.const import do_main
> @@ -62,8 +62,8 @@
>          # otherwise. 
>          for i in range(1, (timeout + 1)):
>              sleep(1)
> -            cs = computersystem.get_cs_class(options.virt)(options.ip,
> -                                                             test_dom)
> +            cs = get_typed_class(options.virt, 'ComputerSystem')\
> +                                 (options.ip, test_dom
>              if cs.Name != test_dom:
>                  Globals.logger.error("VS %s is not defined" % test_dom)
>                  break  
>   
This tc fails with the following error:
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: FAIL
File "04_defineStartVS.py", line 67
if cs.Name != test_dom:
^
SyntaxError: invalid syntax
--------------------------------------------------------------------

> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -42,8 +42,8 @@
>  #						Date  : 17-10-2007
>
>  import sys
> -from XenKvmLib import computersystem
>  from XenKvmLib import vxml
> +from XenKvmLib.classes import get_typed_class
>  from VirtLib import utils
>  from CimTest.Globals import logger
>  from XenKvmLib.const import do_main
> @@ -73,7 +73,8 @@
>              logger.error("ERROR: VS %s was not defined" % test_dom)
>              return status 
>
> -        cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
> +        cs = get_typed_class(options.virt, 'ComputerSystem')\
> +                             (options.ip, test_dom)
>          if cs.Name == test_dom:
>              from_State =  cs.EnabledState
>          else:
> @@ -95,7 +96,8 @@
>
>  #Get the value of the EnabledState property and RequestedState property.
>      try:
> -        cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
> +        cs = get_typed_class(options.virt, 'ComputerSystem')\
> +                             (options.ip, test_dom)
>          if cs.Name == test_dom:
>              to_RequestedState = cs.RequestedState
>              enabledState = cs.EnabledState
>   
The tc fails with the following error
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: FAIL
ERROR - Exception: 'str' object is not callable
--------------------------------------------------------------------

> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -29,7 +29,6 @@
>  # Date: 14-12-2007
>
>  import sys
> -from XenKvmLib import computersystem
>  from VirtLib import utils
>  from XenKvmLib import vxml
>  from XenKvmLib.test_doms import destroy_and_undefine_domain
>   
+1 for me
> diff -r 946fd46b9686 -r db9789b5145f suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py	Thu Aug 28 14:07:25 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/41_cs_to_settingdefinestate.py	Sun Aug 31 19:31:03 2008 -0700
> @@ -58,7 +58,6 @@
>
>  import sys
>  from VirtLib import utils
> -from XenKvmLib import computersystem
>  from XenKvmLib.vxml import get_class
>  from XenKvmLib.classes import get_typed_class
>  from XenKvmLib.test_doms import destroy_and_undefine_all
>
>   
This tc fails with the following error
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: FAIL
ERROR - Failed to create the dom: CrossClass_GuestDom
--------------------------------------------------------------------
> _______________________________________________
> 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