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

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


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1233577717 28800
# Node ID 48a13c2a3f549ed5c93e9e0d99d9399b63c3ec0f
# Parent  aa594a83ba23554622b360346bb18088d510e293
[TEST] Fixed VSSD/03_vssdc_fwd_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 aa594a83ba23 -r 48a13c2a3f54 suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py	Mon Feb 02 04:03:45 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py	Mon Feb 02 04:28:37 2009 -0800
@@ -71,10 +71,11 @@ test_vcpus   = 1
 test_vcpus   = 1
 
 expr_values = {
-    "INVALID_InstID_Keyname"   : { 'rc'   : pywbem.CIM_ERR_FAILED, \
-                     'desc' : 'Missing InstanceID' }, \
-    "INVALID_InstID_Keyval"    : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, \
-                     'desc' : 'No such instance (INVALID_InstID_Keyval)'}
+    "INVALID_InstID_Keyname"   : { 'rc'   : pywbem.CIM_ERR_FAILED, 
+                                   'desc' : 'Missing InstanceID' }, 
+    "INVALID_InstID_Keyval"    : { 'rc'   : pywbem.CIM_ERR_NOT_FOUND, 
+                                   'desc' : 'No such instance '\
+                                            '(INVALID_InstID_Keyval)'}
 }
 
 def try_invalid_assoc(classname, name_val, i, field, virt="Xen"):
@@ -96,41 +97,46 @@ def try_invalid_assoc(classname, name_va
 @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)
 
-    if options.virt == "Xen":
+    if virt == "Xen":
         test_disk = "xvda"
     else: 
         test_disk = "hda"
 
-    virt_xml = vxml.get_class(options.virt)
-    if options.virt == 'LXC':
+    virt_xml = vxml.get_class(virt)
+    if virt == 'LXC':
         cxml = virt_xml(test_dom)
     else:
-        cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk)
-    ret = cxml.create(options.ip)
+        cxml = virt_xml(test_dom, vcpus = test_vcpus, 
+                        mac = test_mac, disk = test_disk)
+
+    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)
-    disk_rasd = get_typed_class(options.virt, 'DiskResourceAllocationSettingData')
-    mem_rasd = get_typed_class(options.virt, 'MemResourceAllocationSettingData')
-    net_rasd = get_typed_class(options.virt, 'NetResourceAllocationSettingData')
-    proc_rasd = get_typed_class(options.virt, 'ProcResourceAllocationSettingData')
+    conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, 
+                                  CIM_PASS), CIM_NS)
+    disk_rasd = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+    mem_rasd = get_typed_class(virt, 'MemResourceAllocationSettingData')
+    net_rasd = get_typed_class(virt, 'NetResourceAllocationSettingData')
+    proc_rasd = get_typed_class(virt, 'ProcResourceAllocationSettingData')
 
     class_id = {
-                disk_rasd : test_disk, \
-                mem_rasd  : 'mem', \
-                net_rasd  : test_mac, \
+                disk_rasd : test_disk, 
+                mem_rasd  : 'mem', 
+                net_rasd  : test_mac, 
                 proc_rasd : '0'
                }
 
@@ -140,7 +146,7 @@ def main():
         devid = "%s/%s" % (test_dom, devid)
         name_val = ['InstanceID', devid]
         for i in range(len(tc_scen)):
-            retval = try_invalid_assoc(classname, name_val, i, tc_scen[i], options.virt)
+            retval = try_invalid_assoc(classname, name_val, i, tc_scen[i], virt)
             if retval != PASS:
                 status = retval
 




More information about the Libvirt-cim mailing list