[Libvirt-cim] [PATCH 2 of 3] [TEST] ElementConforms.02 for XenFV and KVM support

Guo Lian Yun yunguol at cn.ibm.com
Tue Apr 1 07:05:35 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1207033414 25200
# Node ID f34da7c52c40aaba7ec9a9475398a5fcb8825c12
# Parent  bd214f299aa9e4e407b5ca60f3f33c97254379c5
[TEST] ElementConforms.02 for XenFV and KVM support

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

diff -r bd214f299aa9 -r f34da7c52c40 suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py	Tue Apr 01 00:01:14 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py	Tue Apr 01 00:03:34 2008 -0700
@@ -3,6 +3,7 @@
 # Copyright 2008 IBM Corp.
 #
 # Authors:
+#    Guolian Yun <yunguol at cn.ibm.com>
 #    Kaitlin Rupert <karupert at us.ibm.com>
 #    Veerendra Chandrappa <vechandr at in.ibm.com>
 #
@@ -45,11 +46,13 @@ from XenKvmLib import hostsystem
 from XenKvmLib import hostsystem
 from XenKvmLib import computersystem
 from XenKvmLib import assoc
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.test_doms import destroy_and_undefine_all
 from XenKvmLib import enumclass
+from XenKvmLib.vxml import XenXML, KVMXML, get_class
 from CimTest.ReturnCodes import PASS, FAIL
 
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
 
 test_dom = "domgst"
 
@@ -82,10 +85,10 @@ def main():
 
     status = FAIL
     log_param()
-    destroy_and_undefine_all(options.ip)
-    test_xml = testxml(test_dom)
-
-    ret = test_domain_function(test_xml, options.ip, cmd = "create")
+    destroy_and_undefine_all(options.ip, options.virt)
+    vsxml = get_class(options.virt)(test_dom)
+    vsxml.define(options.ip)
+    ret = vsxml.start(options.ip)
     if not ret:
         logger.error("ERROR: Failed to Create the dom: %s" % test_dom)
         return status
@@ -93,7 +96,7 @@ def main():
     inst_list = []
 
     try:
-        cs_list = computersystem.enumerate(options.ip)
+        cs_list = computersystem.enumerate(options.ip, options.virt)
         # The len should be atleast two, as the CS returns info
         # one regarding VS and the other one for Domain-0. 
         if len(cs_list) < 1:
@@ -109,7 +112,7 @@ def main():
             return status
 
         #Getting the hostname, to verify with the value returned by the assoc.
-        host_sys = hostsystem.enumerate(options.ip)
+        host_sys = hostsystem.enumerate(options.ip, options.virt)
 
         if len(host_sys) < 1:
             logger.error("ERROR: Enumerate returned 0 host instances")
@@ -126,15 +129,16 @@ def main():
 
     prev_namespace = Globals.CIM_NS
     Globals.CIM_NS = 'root/interop'
-
+    
     try:
         key_list = ["InstanceID"]
         proflist = enumclass.enumerate(options.ip, \
-                                    enumclass.Xen_RegisteredProfile, \
-                                    key_list)
+                                       "RegisteredProfile", \
+                                       key_list,
+                                       options.virt)
     except Exception, detail:
         logger.error(CIM_ERROR_ENUMERATE, \
-                             'Xen_RegisteredProfile')
+                             'RegisteredProfile')
         logger.error("Exception: %s", detail)
         return status
 
@@ -148,8 +152,9 @@ def main():
             cn = item.CreationClassName
             name = item.Name
             profs = assoc.Associators(options.ip,
-                                      "Xen_ElementConformsToProfile",
-                                      cn, 
+                                      "ElementConformsToProfile",
+                                      cn,
+                                      options.virt, 
                                       CreationClassName=cn,
                                       Name=name)
             if len(profs) != 1:
@@ -161,11 +166,13 @@ def main():
                 logger.error("Verification of profile instance failed")
 
     except Exception, detail:
-        logger.error(CIM_ERROR_ASSOCIATORS, 'Xen_RegisteredProfile')
+        logger.error(CIM_ERROR_ASSOCIATORS, 'RegisteredProfile')
         logger.error("Exception: %s", detail)
         status = FAIL
-
-    ret = test_domain_function(test_dom, options.ip, cmd = "destroy")
+    
+    vsxml.destroy(options.ip)
+    vsxml.undefine(options.ip)
+    
     return status
 
 if __name__ == "__main__":




More information about the Libvirt-cim mailing list