[Libvirt-cim] [PATCH] [TEST] add VirtualSystemSettingDataComponent.03 for XenFV & KVM support

Guo Lian Yun yunguol at cn.ibm.com
Fri Apr 18 05:35:48 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1208496944 -28800
# Node ID bd227552046d59c9a7fbfc4cbed41751fe0e675e
# Parent  c1d9b3ba06ca4c76fe9b1cf63a77a7f92bb01d22
[TEST] add VirtualSystemSettingDataComponent.03 for XenFV & KVM support

Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>

diff -r c1d9b3ba06ca -r bd227552046d suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py	Thu Apr 17 10:12:46 2008 +0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py	Fri Apr 18 13:35:44 2008 +0800
@@ -55,20 +55,19 @@
 import pywbem
 from VirtLib import utils
 from XenKvmLib import assoc
-from XenKvmLib.test_xml import testxml
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
 from XenKvmLib.common_util import try_assoc
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
+from XenKvmLib.test_doms import destroy_and_undefine_all
 from CimTest.ReturnCodes import PASS, FAIL
 from CimTest.Globals import do_main, log_param, logger
 from CimTest.Globals import CIM_USER, CIM_PASS, CIM_NS
 
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
 
-ac_classname = 'Xen_VirtualSystemSettingDataComponent'
 test_dom     = "domu1"
 test_mac     = "00:11:22:33:44:aa"
 test_vcpus   = 1
-test_disk    = 'xvda'
 
 expr_values = {
     "INVALID_InstID_Keyname"   : { 'rc'   : pywbem.CIM_ERR_FAILED, \
@@ -77,7 +76,8 @@
                      'desc' : 'No such instance (INVALID_InstID_Keyval)'}
 }
 
-def try_invalid_assoc(classname, name_val, i, field):
+def try_invalid_assoc(classname, name_val, i, field, virt="Xen"):
+    ac_classname = get_typed_class(virt, "VirtualSystemSettingDataComponent")
     keys = {}
     temp = name_val[i]
     name_val[i] = field
@@ -103,23 +103,32 @@
     status = PASS
 
     destroy_and_undefine_all(options.ip)
-    test_xml = testxml(test_dom, vcpus = test_vcpus, mac = test_mac, \
-                       disk = test_disk)
 
-    ret = test_domain_function(test_xml, options.ip, cmd = "create")
+    if options.virt == "Xen":
+        test_disk = "xvda"
+    else: 
+        test_disk = "hda"
+
+    virt_xml = vxml.get_class(options.virt)
+    cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk)
+    ret = cxml.create(options.ip)
     if not ret:
-        logger.error("Failed to Create the dom: %s", test_dom)
+        logger.error('Unable to create 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')
 
     class_id = {
-                'Xen_DiskResourceAllocationSettingData' : test_disk, \
-                'Xen_MemResourceAllocationSettingData'  : 'mem', \
-                'Xen_NetResourceAllocationSettingData'  : test_mac, \
-                'Xen_ProcResourceAllocationSettingData' : '0'
+                disk_rasd : test_disk, \
+                mem_rasd  : 'mem', \
+                net_rasd  : test_mac, \
+                proc_rasd : '0'
                }
 
     tc_scen = ['INVALID_InstID_Keyname', 'INVALID_InstID_Keyval']
@@ -128,11 +137,13 @@
         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])
+            retval = try_invalid_assoc(classname, name_val, i, tc_scen[i], options.virt)
             if retval != PASS:
                 status = retval
 
-    test_domain_function(test_dom, options.ip, cmd = "destroy")
+    cxml.destroy(options.ip)
+    cxml.undefine(options.ip)
+    
     return status
 
 if __name__ == "__main__":




More information about the Libvirt-cim mailing list