[Libvirt-cim] [PATCH] [TEST] Fixing the 02_hostsystem_to_rasd.py tc

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Tue Apr 8 12:24:18 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1207657455 -19800
# Node ID 4b2bfa729df71d618e7bc8e3b1b89eacf86c419b
# Parent  6e8932e6628a5475b39e196bb8b5182b5c5a3f11
[TEST] Fixing the 02_hostsystem_to_rasd.py tc.

1) Fixed the tc failure.
2) Removed ununsed import stmt.
3) updated it to use the xml_get_disk_source() to get disk info.

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

diff -r 6e8932e6628a -r 4b2bfa729df7 suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
--- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py	Tue Apr 08 16:23:16 2008 +0530
+++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py	Tue Apr 08 17:54:15 2008 +0530
@@ -47,10 +47,8 @@
 #                                                                      Date : 29.01.2008
 
 import sys
-from VirtLib import utils
-from CimTest import Globals
 from CimTest.Globals import do_main
-from XenKvmLib.vxml import XenXML, KVMXML, get_class
+from XenKvmLib.vxml import get_class
 from XenKvmLib.classes import get_typed_class
 from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
 from XenKvmLib.assoc import Associators, AssociatorNames
@@ -73,34 +71,35 @@ def init_list(virt="Xen"):
     """
         Creating the lists that will be used for comparisons.
     """
-    disk_path = "/tmp/default-%s-dimage" % virt.lower()
+    disk_path = vsxml.xml_get_disk_source()
 
     rasd_values = {"%s_Processor" % virt  : {
-                                             "InstanceID" : '%s/%s' %(test_dom,0),\
-                                             "ResourceType" : 3,\
-                                            }, \
+                                             "InstanceID" : '%s/%s' %(test_dom,0),
+                                             "ResourceType" : 3,
+                                            }, 
                    "%s_LogicalDisk" % virt: {
-                                             "InstanceID"  : '%s/%s' %(test_dom, test_disk), \
-                                             "ResourceType" : 17, \
-                                             "Address"      : disk_path, \
-                                            }, \
+                                             "InstanceID"  : '%s/%s' %(test_dom, test_disk), 
+                                             "ResourceType" : 17, 
+                                             "Address"      : disk_path, 
+                                            }, 
                    "%s_NetworkPort" % virt: {
-                                              "InstanceID"  : '%s/%s' %(test_dom,test_mac), \
-                                              "ResourceType" : 10 , \
-                                              "ntype1": "bridge", \
-                                              "ntype2": "ethernet", \
-                                            }, \
+                                              "InstanceID"  : '%s/%s' %(test_dom,test_mac), 
+                                              "ResourceType" : 10 , 
+                                              "ntype1": "bridge", 
+                                              "ntype2": "ethernet", 
+                                            }, 
                    "%s_Memory"% virt:       {
-                                              "InstanceID"  : '%s/%s' %(test_dom, "mem"), \
-                                              "ResourceType" : 4, \
-                                              "AllocationUnits" : "MegaBytes",\
-                                              "VirtualQuantity" : (test_mem * 1024), \
+                                              "InstanceID"  : '%s/%s' %(test_dom, "mem"), 
+                                              "ResourceType" : 4, 
+                                              "AllocationUnits" : "KiloBytes",
+                                              "VirtualQuantity" : (test_mem * 1024), 
                                             }
                   } 
 
     return rasd_values
 
 def setup_env(server, virt="Xen"):
+    vsxml_info = None
     status = PASS
     destroy_and_undefine_all(server)
     global test_disk
@@ -108,17 +107,18 @@ def setup_env(server, virt="Xen"):
         test_disk = "xvda"
     else: 
         test_disk = "hda"
-    
-    vsxml = get_class(virt)(test_dom, mem = test_mem,
+    virt_xml =  get_class(virt)
+    vsxml_info = virt_xml(test_dom, mem = test_mem,
                             vcpus=test_vcpus,
                             mac = test_mac,
                             disk = test_disk)
     
-    ret = vsxml.define(server)
+    ret = vsxml_info.define(server)
     if not ret:
         logger.error("Failed to define the dom: %s", test_dom)
         status = FAIL
-    return status
+
+    return status, vsxml_info
 
 def print_err(err, detail, cn):
     logger.error(err % cn)
@@ -214,15 +214,16 @@ def main():
 def main():
     options = main.options
     log_param()
+    global vsxml 
     server = options.ip
     status = PASS
     status, host_name, classname = get_host_info(server, options.virt)
     if status != PASS:
         return status
     if options.virt == "XenFV":
-       options.virt = "Xen"
-    status = setup_env(server, options.virt)
-    if status != PASS:
+        options.virt = "Xen"
+    status, vsxml = setup_env(server, options.virt)
+    if status != PASS or vsxml == None:
         return status
     cn   = classname
     an   = get_typed_class(options.virt, 'HostedDependency')




More information about the Libvirt-cim mailing list