# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1211459246 25200
# Node ID 41f9bf4831ff672dfc36de4510bf5c33d5a29154
# Parent 2039130968f0c4e19234dcfbba9940eddbcd7325
[TEST] Fixing tc 05_destroysystem_neg.py of VirtualSystemManagementService.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 2039130968f0 -r 41f9bf4831ff
suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py
---
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Wed
May 21 06:37:47 2008 -0700
+++
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Thu
May 22 05:27:26 2008 -0700
@@ -27,44 +27,73 @@ from VirtLib import utils
from VirtLib import utils
from XenKvmLib import vsms
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.const import CIM_REV
from XenKvmLib.test_doms import undefine_test_domain
from CimTest.Globals import logger
from CimTest.Globals import do_main
from CimTest.ReturnCodes import FAIL, PASS, SKIP
sup_types = ['Xen', 'KVM', 'XenFV']
+vsms_status_version = 534
def destroysystem_fail(tc, options):
service = vsms.get_vsms_class(options.virt)(options.ip)
classname = get_typed_class(options.virt, 'ComputerSystem')
+
if tc == 'noname':
- exp_rc = 2 #IM_RC_FAILED
cs_ref = CIMInstanceName(classname,
- keybindings = {'CreationClassName':classname})
+ keybindings = {'CreationClassName':classname})
+
+ if CIM_REV < vsms_status_version:
+ exp_rc = 2 #IM_RC_FAILED
+ else:
+ exp_value = { 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : 'CIM_ERR_FAILED: Unable to retrieve
domain\
+ name.'
+ }
+
elif tc == 'nonexistent':
- exp_rc = 4 #IM_RC_SYS_NOT_FOUND
cs_ref = CIMInstanceName(classname,keybindings = {
- 'Name':'##@@!!cimtest_domain',
- 'CreationClassName':classname})
+ 'Name':'##@@!!cimtest_domain',
+ 'CreationClassName':classname})
+
+ if CIM_REV < vsms_status_version:
+ exp_rc = 4 #IM_RC_SYS_NOT_FOUND
+ else:
+ exp_value = { 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : 'CIM_ERR_FAILED: Failed to find
domain'
+ }
+
else:
return SKIP
status = FAIL
try:
ret = service.DestroySystem(AffectedSystem=cs_ref)
- if ret[0] == exp_rc:
- status = PASS
- logger.info('destroy_fail>>%s: Got expected return code %s' %
(tc, exp_rc))
- else:
- status = FAIL
- logger.error('destroy_fail>>%s: Got rc: %s, but we expect %s' %
(tc, ret[0], exp_rc))
+ if CIM_REV < vsms_status_version:
+ if ret[0] == exp_rc:
+ logger.info('destroy_fail>>%s: Got expected return code
%s',
+ tc, exp_rc)
+ return PASS
+ else:
+ logger.error('destroy_fail>>%s: Got rc: %s, but we expect
%s',
+ tc, ret[0], exp_rc)
+ return FAIL
+
except Exception, details:
- logger.error('destroy_fail>>%s: Error executing DestroySystem,
exception details below' % tc)
+ if CIM_REV >= vsms_status_version:
+ err_no = details[0]
+ err_desc = details[1]
+ if err_no == exp_value['rc'] and err_desc ==
exp_value['desc']:
+ logger.error("For Invalid Scenario '%s'", tc)
+ logger.info('Got expected error no: %s', err_no)
+ logger.info('Got expected error desc: %s',err_desc)
+ return PASS
+
+ logger.error('destroy_fail>> %s: Error executing DestroySystem' %
tc)
logger.error(details)
- status = FAIL
-
- return status
+ return FAIL
@do_main(sup_types)
def main():