
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1233604950 28800 # Node ID fa1424f9b3f4ae005b4fcc34e18858035cc8f102 # Parent 912b7615d48c8303fd3daa6e55669c6d66af23e4 [TEST] Update VSMS 03_definesystem_ess.py to use cim_define() Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 912b7615d48c -r fa1424f9b3f4 suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py Mon Feb 02 04:45:23 2009 -0800 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py Mon Feb 02 12:02:30 2009 -0800 @@ -23,17 +23,14 @@ # import sys -import pywbem -from VirtLib import utils -from XenKvmLib import vsms -from XenKvmLib.test_doms import undefine_test_domain -from XenKvmLib.common_util import create_using_definesystem +from pywbem import CIM_ERR_FAILED from CimTest.Globals import logger from XenKvmLib.const import do_main from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.vxml import get_class sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] -exp_rc = 1 #CMPI_RC_ERR_FAILED +exp_rc = CIM_ERR_FAILED exp_desc = 'Unable to parse embedded object' @do_main(sup_types) @@ -42,25 +39,31 @@ dname = 'test_domain' - vssd, rasd = vsms.default_vssd_rasd_str(dom_name=dname, virt=options.virt) + cxml = get_class(options.virt)(dname) + cxml.set_sys_settings("wrong") - params = {'vssd' : 'wrong', - 'rasd' : rasd - } + ret = cxml.cim_define(options.ip) + if ret: + logger.error('DefineSystem should NOT return OK with a wrong ss input') + status = FAIL - exp_err = {'exp_rc' : exp_rc, - 'exp_desc' : exp_desc - } + try: + if int(cxml.err_rc) != exp_rc: + raise Exception("Got rc: %d, exp %d." % (int(cxml.err_rc), exp_rc)) - rc = create_using_definesystem(dname, options.ip, params, ref_config=' ', - exp_err=exp_err, virt=options.virt) + if cxml.err_desc.find(exp_desc) < 0: + raise Exception("Got desc: '%s', exp '%s'" % (cxml.err_desc, + exp_desc)) - if rc != PASS: - logger.error('DefineSystem should NOT return OK with a wrong ss input') + status = PASS - undefine_test_domain(dname, options.ip, virt=options.virt) + except Exception, details: + logger.error(details) + status = FAIL - return rc + cxml.undefine(options.ip) + + return status if __name__ == "__main__": sys.exit(main())