[Libvirt-cim] [PATCH] [TEST] .2# rebased VirtualSystemSettingDataComponent.02 for XenFV & KVM support

Guo Lian Yun yunguol at cn.ibm.com
Mon Apr 21 03:00:41 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1208746833 -28800
# Node ID 359a198f236c0733587423009200fcde5c2a02f3
# Parent  0d31dff13ae341fd6515dc844ee98c7b5300b71d
[TEST] .2# rebased VirtualSystemSettingDataComponent.02 for XenFV & KVM support

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

diff -r 0d31dff13ae3 -r 359a198f236c suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py	Fri Apr 18 17:00:16 2008 +0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py	Mon Apr 21 11:00:33 2008 +0800
@@ -47,23 +47,21 @@
 import sys
 from XenKvmLib import enumclass
 from VirtLib import utils
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all 
-from XenKvmLib import test_xml
-from XenKvmLib.test_xml import testxml
 from CimTest import Globals 
 from XenKvmLib import assoc
+from XenKvmLib.test_doms import destroy_and_undefine_all 
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
 from XenKvmLib.rasd import InstId_err
 from CimTest.Globals import log_param, logger, do_main
 from CimTest.ReturnCodes import PASS, FAIL
 
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
 
 test_dom    = "VSSDC_dom"
 test_vcpus  = 1
 test_mem    = 128
 test_mac    = "00:11:22:33:44:aa"
-test_disk   = 'xvdb'
-VSType      = "Xen"
 
 def check_rasd_values(id, exp_id):
     try:
@@ -77,7 +75,7 @@
 
     return PASS
 
-def assoc_values(ip, assoc_info):
+def assoc_values(ip, assoc_info, virt="Xen"):
     """
         The association info of 
         Xen_VirtualSystemSettingDataComponent is
@@ -95,17 +93,22 @@
             logger.error("No RASD instances returned")
             return FAIL
 
+        proc_cn = get_typed_class(virt, 'ProcResourceAllocationSettingData')
+        net_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+        disk_cn = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+        mem_cn = get_typed_class(virt, 'MemResourceAllocationSettingData')
+    
         for inst in assoc_info: 
-            if inst.classname == 'Xen_ProcResourceAllocationSettingData':
+            if inst.classname == proc_cn:
                 status = check_rasd_values(inst['InstanceID'], 
                                            rasd_list['proc_rasd'])
-            elif inst.classname == 'Xen_NetResourceAllocationSettingData':
+            elif inst.classname == net_cn:
                 status = check_rasd_values(inst['InstanceID'], 
                                            rasd_list['net_rasd'])
-            elif inst.classname == 'Xen_DiskResourceAllocationSettingData': 
+            elif inst.classname == disk_cn: 
                 status = check_rasd_values(inst['InstanceID'], 
                                            rasd_list['disk_rasd'])
-            elif inst.classname == 'Xen_MemResourceAllocationSettingData': 
+            elif inst.classname == mem_cn: 
                 status = check_rasd_values(inst['InstanceID'], 
                                            rasd_list['mem_rasd'])
             else:
@@ -129,32 +132,41 @@
     log_param()
 
     destroy_and_undefine_all(options.ip)
-    test_xml1 = testxml(test_dom, mem = test_mem, \
-                               vcpus = test_vcpus, \
-                                   mac = test_mac, \
-                                    disk = test_disk)
 
-    ret = test_domain_function(test_xml1, options.ip, cmd = "create")
+    global test_disk
+    if options.virt == "Xen":
+        test_disk = "xvdb"
+    else:
+        test_disk = "hdb"
+    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)
         status = FAIL
         return status
 
 
-    instIdval = "%s:%s" % (VSType, test_dom)
+    if options.virt == "Xen" or options.virt == "XenFV":
+        instIdval = "Xen:%s" % test_dom
+    else:
+        instIdval = "KVM:%s" % test_dom
+
     try:
         assoc_info = assoc.AssociatorNames(options.ip,
-                                        'Xen_VirtualSystemSettingDataComponent',
-                                        'Xen_VirtualSystemSettingData',
-                                        InstanceID = instIdval)
-        status = assoc_values(options.ip, assoc_info)
+                                           'VirtualSystemSettingDataComponent',
+                                           'VirtualSystemSettingData',
+                                           options.virt,
+                                           InstanceID = instIdval)
+        status = assoc_values(options.ip, assoc_info, options.virt)
     except  Exception, detail :
         logger.error(Globals.CIM_ERROR_ASSOCIATORS, 
-                     'Xen_VirtualSystemSettingDataComponent')
+                     'VirtualSystemSettingDataComponent')
         logger.error("Exception : %s" % detail)
         status = FAIL
 
-    test_domain_function(test_dom, options.ip, "destroy")
+    cxml.destroy(options.ip)
+    cxml.undefine(options.ip)
     return status
 
 if __name__ == "__main__":




More information about the Libvirt-cim mailing list