+exp_rc = 13
+exp_desc = 'CIM_ERR_TYPE_MISMATCH'
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+default_dom = 'domain'
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ cxml = get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s", default_dom)
+ return FAIL
+
+ rc = -1
+ try:
+ bad_inst = 'instance of what ever dfs&'
This will just verify the CIMOM, since the CIMOM will check the type of
the parameter.
Instead, you need to create a RASD instance, but have something in the
instance be invalid. One example would be to create a RASD of a class
type we don't support, or set all of the attributes to NULL / 0.
+ service = get_vsms_class(options.virt)(options.ip)
+ ret = service.RemoveResourceSettings(ResourceSettings=[bad_inst])
+ if ret[0] == 0:
+ logger.error('RemoveRS should NOT return OK with wrong RS input')
+ rc = 0
Why do you set the rc value here? You don't check it afterwards.
+ except pywbem.CIMError, (rc, desc):
+ if rc == exp_rc and desc.find(exp_desc) >= 0:
+ logger.info('Got expected rc code and error string')
+ status = PASS
+ else:
+ logger.error('Unexpected rc code %s and description"\n %s',
+ rc, desc)
+ status = FAIL
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ cxml.undefine(options.ip)
+ return status
+
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com