[Libvirt-cim] [PATCH] [TEST] Fixed VSSD/04_vssdc_rev_errs.py tc by using cim_define() and cim_start()

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Mon Feb 2 12:46:24 UTC 2009


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1233578723 28800
# Node ID 4124eabc89cabd32e3fe905194a55dac0c949249
# Parent  48a13c2a3f549ed5c93e9e0d99d9399b63c3ec0f
[TEST] Fixed VSSD/04_vssdc_rev_errs.py tc by using cim_define() and cim_start().

Also, fixed indentation in the tc to fit the 80 columns.

Tested for Xen with current sources.

Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r 48a13c2a3f54 -r 4124eabc89ca suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/04_vssdc_rev_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/04_vssdc_rev_errs.py	Mon Feb 02 04:28:37 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/04_vssdc_rev_errs.py	Mon Feb 02 04:45:23 2009 -0800
@@ -69,13 +69,13 @@ from CimTest.Globals import CIM_USER, CI
 
 sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
 
-test_dom     = "domu1"
+test_dom = "domu1"
 
 expr_values = {
-    "INVALID_InstID_Keyname"   : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, \
-                     'desc' : 'No such instance (InstanceID)' }, \
-    "INVALID_InstID_Keyval"    : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, \
-                     'desc' : 'No such instance (InstanceID)'}
+    "INVALID_InstID_Keyname"  : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, 
+                                  'desc' : 'No such instance (InstanceID)' },
+    "INVALID_InstID_Keyval"   : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, 
+                                  'desc' : 'No such instance (InstanceID)'}
 }
 
 def try_invalid_assoc(name_val, i, field, virt="Xen"):
@@ -87,8 +87,8 @@ def try_invalid_assoc(name_val, i, field
     for j in range(len(name_val)/2):
         k = j * 2
         keys[name_val[k]] = name_val[k+1]
-    ret_val = try_assoc(conn, classname, ac_classname, keys, field_name=field, \
-                              expr_values=expr_values[field], bug_no='')
+    ret_val = try_assoc(conn, classname, ac_classname, keys, field_name=field, 
+                        expr_values=expr_values[field], bug_no='')
     if ret_val != PASS:
         logger.error("------ FAILED: %s %s------", classname, field)
     name_val[i] = temp
@@ -98,36 +98,41 @@ def try_invalid_assoc(name_val, i, field
 @do_main(sup_types)
 def main():
     options = main.options
-    if not options.ip:
-        parser.print_help()
-        return FAIL
+    virt = options.virt
 
     status = PASS
 
     destroy_and_undefine_all(options.ip)
 
-    virt_xml = vxml.get_class(options.virt)
+    virt_xml = vxml.get_class(virt)
     cxml = virt_xml(test_dom)
-    ret = cxml.create(options.ip)
+
+    ret = cxml.cim_define(options.ip)
     if not ret:
-        logger.error('Unable to create domain %s' % test_dom)
+        logger.error('Unable to define domain %s' % test_dom)
+        return FAIL
+
+    status = cxml.cim_start(options.ip)
+    if status != PASS:
+        cxml.undefine(options.ip)
+        logger.error('Unable to start domain %s' % test_dom)
         return FAIL
 
     global conn
-    conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, \
-                                                        CIM_PASS), CIM_NS)
+    conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, 
+                                   CIM_PASS), CIM_NS)
 
     tc_scen = ['INVALID_InstID_Keyname', 'INVALID_InstID_Keyval']
   
-    if options.virt == "Xen" or options.virt == "XenFV":
+    if virt == "Xen" or virt == "XenFV":
         inst_id = "Xen:%s" % test_dom
     else:
-        inst_id = "%s:%s" % (options.virt, test_dom)
+        inst_id = "%s:%s" % (virt, test_dom)
   
     name_val = ['InstanceID', inst_id]
 
     for i in range(len(tc_scen)):
-        retval = try_invalid_assoc(name_val, i, tc_scen[i], options.virt)
+        retval = try_invalid_assoc(name_val, i, tc_scen[i], virt)
         if retval != PASS:
             status = retval
 




More information about the Libvirt-cim mailing list