[PATCH] [TEST] Fix exception in tests

# HG changeset patch # User Eduardo Lima (Etrunko) <eblima@br.ibm.com> # Date 1309289907 10800 # Node ID 6397c0670c35acc78ac13d737b408bb90e30632e # Parent 3c218fe48bb7b9d89549dcca213dd7e0b60035af [TEST] Fix exception in tests -------------------------------------------------------------------- Memory - 01_memory.py: FAIL ERROR - Got CIM error CIM_ERR_FAILED: Failed to define domain: operation virDomainDefineXML forbidden for read only access with return code 1 Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "01_memory.py", line 66, in main capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 AttributeError: 'NoneType' object has no attribute 'ConsumableBlocks' -------------------------------------------------------------------- SettingsDefineCapabilities - 01_forward.py: FAIL ERROR - [dpool, mpool, ppool, npool] None ERROR - TypeError : 'int' object is not iterable Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "01_forward.py", line 204, in main status, pool = get_pool_details(virt, server) TypeError: 'int' object is not iterable -------------------------------------------------------------------- VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: FAIL ERROR - Exception: 'NoneType' object has no attribute 'InstanceID' ERROR - Unable to get template RASDs for vsi_guest ERROR - UnboundLocalError : local variable 'cxml' referenced before assignment Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "28_definesystem_with_vsi_profile.py", line 211, in main cxml.cim_destroy(server) UnboundLocalError: local variable 'cxml' referenced before assignment Signed-off-by: Eduardo Lima (Etrunko) <eblima@br.ibm.com> diff --git a/suites/libvirt-cim/cimtest/Memory/01_memory.py b/suites/libvirt-cim/cimtest/Memory/01_memory.py --- a/suites/libvirt-cim/cimtest/Memory/01_memory.py +++ b/suites/libvirt-cim/cimtest/Memory/01_memory.py @@ -59,15 +59,16 @@ if dev is None: logger.error("GetInstance() returned None") status = 1 - elif dev.ConsumableBlocks > dev.NumberOfBlocks: - logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") - status = 1 + else: + if dev.ConsumableBlocks > dev.NumberOfBlocks: + logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") + status = 1 - capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 + capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 - if capacity != alloc_mem: - logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) - status = 1 + if capacity != alloc_mem: + logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) + status = 1 if status == 0: logger.info("Checked memory capacity: %s MB", capacity) diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py @@ -142,7 +142,7 @@ if dpool.InstanceID == None or mpool.InstanceID == None \ or npool.InstanceID == None or ppool.InstanceID == None: logger.error("Get pool None") - return FAIL + return FAIL, None else: pool_set = [dpool, mpool, ppool, npool] except Exception, detail: diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py @@ -175,6 +175,7 @@ nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') status = FAIL + cxml = None try: rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn) @@ -208,8 +209,9 @@ except Exception, details: logger.error(details) - cxml.cim_destroy(server) - cxml.undefine(server) + if cxml is not None: + cxml.cim_destroy(server) + cxml.undefine(server) return status

+1. Here's my results: -------------------------------------------------------------------- Memory - 01_memory.py: PASS -------------------------------------------------------------------- SettingsDefineCapabilities - 01_forward.py: PASS -------------------------------------------------------------------- VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL ERROR - Got CIM error CIM_ERR_FAILED: Unable to start domain: internal error interface eth1 does not exist with return code 1 ERROR - Unable to start VM *** Is VSI support available on this host? *** InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Unable to start domain: internal error interface eth1 does not exist -------------------------------------------------------------------- The failure appears unrelated to your patch. Pushed. On 06/28/2011 03:39 PM, Eduardo Lima (Etrunko) wrote:
# HG changeset patch # User Eduardo Lima (Etrunko)<eblima@br.ibm.com> # Date 1309289907 10800 # Node ID 6397c0670c35acc78ac13d737b408bb90e30632e # Parent 3c218fe48bb7b9d89549dcca213dd7e0b60035af [TEST] Fix exception in tests
-------------------------------------------------------------------- Memory - 01_memory.py: FAIL ERROR - Got CIM error CIM_ERR_FAILED: Failed to define domain: operation virDomainDefineXML forbidden for read only access with return code 1 Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "01_memory.py", line 66, in main capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 AttributeError: 'NoneType' object has no attribute 'ConsumableBlocks'
-------------------------------------------------------------------- SettingsDefineCapabilities - 01_forward.py: FAIL ERROR - [dpool, mpool, ppool, npool] None ERROR - TypeError : 'int' object is not iterable Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "01_forward.py", line 204, in main status, pool = get_pool_details(virt, server) TypeError: 'int' object is not iterable
-------------------------------------------------------------------- VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: FAIL ERROR - Exception: 'NoneType' object has no attribute 'InstanceID' ERROR - Unable to get template RASDs for vsi_guest ERROR - UnboundLocalError : local variable 'cxml' referenced before assignment Traceback (most recent call last): File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try rc = f() File "28_definesystem_with_vsi_profile.py", line 211, in main cxml.cim_destroy(server) UnboundLocalError: local variable 'cxml' referenced before assignment
Signed-off-by: Eduardo Lima (Etrunko)<eblima@br.ibm.com>
diff --git a/suites/libvirt-cim/cimtest/Memory/01_memory.py b/suites/libvirt-cim/cimtest/Memory/01_memory.py --- a/suites/libvirt-cim/cimtest/Memory/01_memory.py +++ b/suites/libvirt-cim/cimtest/Memory/01_memory.py @@ -59,15 +59,16 @@ if dev is None: logger.error("GetInstance() returned None") status = 1 - elif dev.ConsumableBlocks> dev.NumberOfBlocks: - logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") - status = 1 + else: + if dev.ConsumableBlocks> dev.NumberOfBlocks: + logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") + status = 1
- capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 + capacity = dev.ConsumableBlocks * dev.BlockSize / 1024
- if capacity != alloc_mem: - logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) - status = 1 + if capacity != alloc_mem: + logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) + status = 1
if status == 0: logger.info("Checked memory capacity: %s MB", capacity) diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py @@ -142,7 +142,7 @@ if dpool.InstanceID == None or mpool.InstanceID == None \ or npool.InstanceID == None or ppool.InstanceID == None: logger.error("Get pool None") - return FAIL + return FAIL, None else: pool_set = [dpool, mpool, ppool, npool] except Exception, detail: diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py @@ -175,6 +175,7 @@
nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') status = FAIL + cxml = None
try: rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn) @@ -208,8 +209,9 @@ except Exception, details: logger.error(details)
- cxml.cim_destroy(server) - cxml.undefine(server) + if cxml is not None: + cxml.cim_destroy(server) + cxml.undefine(server)
return status
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent@linux.vnet.ibm.com
participants (2)
-
Chip Vincent
-
Eduardo Lima (Etrunko)