I'm seeing a new failure with this patch:
NetworkPort - 01_netport.py: FAIL
ERROR - CIMError : (16, u'CIM_ERR_METHOD_NOT_AVAILABLE: __nonzero__')
Traceback (most recent call last):
File
"/home/cvincent/tmp/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py",
line 140, in do_try
rc = f()
File "01_netport.py", line 86, in main
if not dev:
File "/home/cvincent/tmp/cimtest/lib/CimTest/CimExt.py", line 32, in
__call__
return self.__invoker(self.__name, args)
File
"/home/cvincent/tmp/cimtest/suites/libvirt-cim/lib/XenKvmLib/enumclass.py",
line 108, in __invoke
**params)
File "/usr/lib/python2.6/site-packages/pywbem/cim_operations.py",
line 801, in InvokeMethod
result = self.methodcall(MethodName, obj, **params)
File "/usr/lib/python2.6/site-packages/pywbem/cim_operations.py",
line 362, in methodcall
raise CIMError(code, tt[0][1]['DESCRIPTION'])
CIMError: (16, u'CIM_ERR_METHOD_NOT_AVAILABLE: __nonzero__')
ERROR - None
InvokeMethod(__nonzero__): CIM_ERR_METHOD_NOT_AVAILABLE: __nonzero__
On 06/01/2011 04:43 PM, Eduardo Lima (Etrunko) wrote:
# HG changeset patch
# User Eduardo Lima (Etrunko)<eblima(a)br.ibm.com>
# Date 1306960999 10800
# Node ID 373d418b222c25309db3d83dd384abf61127ebe9
# Parent f303bd9615f23b8b79c5532dd5489899a13a0f8e
Cimtest: Check for None return value
Some tests were raising Attribute Exception due to None value returned.
Signed-off-by: Eduardo Lima (Etrunko)<eblima(a)br.ibm.com>
diff --git a/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py
b/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py
--- a/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py
+++ b/suites/libvirt-cim/cimtest/LogicalDisk/01_disk.py
@@ -57,7 +57,10 @@
dev = GetInstance(options.ip, disk, key_list)
status = 0
- if dev.Name != test_dev:
+ if not dev:
+ logger.error("GetInstance() returned None")
+ status = 1
+ else if dev.Name != test_dev:
logger.error("Name should be `%s' instead of `%s'", test_dev,
dev.Name)
status = 1
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
@@ -56,7 +56,10 @@
status = 0
- if dev.ConsumableBlocks> dev.NumberOfBlocks:
+ if not dev:
+ logger.error("GetInstance() returned None")
+ status = 1
+ else if dev.ConsumableBlocks> dev.NumberOfBlocks:
logger.error("ConsumableBlocks should not be larger than
NumberOfBlocks")
status = 1
diff --git a/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py
b/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py
--- a/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py
+++ b/suites/libvirt-cim/cimtest/NetworkPort/01_netport.py
@@ -83,6 +83,11 @@
vsxml.undefine(options.ip)
return FAIL
+ if not dev:
+ logger.error("GetInstance() returned None")
+ vsxml.undefine(options.ip)
+ return FAIL
+
if dev.DeviceID == None:
logger.error("Error retrieving instance for devid %s", devid)
vsxml.undefine(options.ip)
diff --git
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py
---
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py
+++
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py
@@ -47,6 +47,10 @@
rasds = get_default_rasds(options.ip, options.virt)
+ if not rasds:
+ logger.error("get_default_rasds() returned None")
+ return FAIL
+
rasd_list = {}
for rasd in rasds:
@@ -56,6 +60,10 @@
rasd['AllocationUnits'] = units
rasd_list[mrasd_cn] = inst_to_mof(rasd)
+ if mrasd_cn not in rasd_list.keys():
+ logger.error("Key '%s' not found in dictionary '%s'" %
(mrasd_cn, rasd_list))
+ return FAIL
+
if rasd_list[mrasd_cn] is None:
logger.error("Unable to get template MemRASD")
return FAIL
diff --git
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
@@ -154,7 +154,7 @@
logger.error(details)
status = FAIL
- if os.path.exists(addr):
+ if addr and os.path.exists(addr):
os.remove(addr)
if guest_defined == True:
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent(a)linux.vnet.ibm.com