[Libvirt-cim] [PATCH] [TEST] Fix domain created error in RASD.01

Guo Lian Yun yunguol at cn.ibm.com
Mon Apr 7 09:26:18 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1207560373 25200
# Node ID 4578382726b1d2099c9b467a0532052b67af42e9
# Parent  bedc7fc28125f9d6cc21f7a6752b479313f070e5
[TEST] Fix domain created error in RASD.01

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

diff -r bedc7fc28125 -r 4578382726b1 suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py
--- a/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py	Fri Apr 04 12:25:02 2008 +0530
+++ b/suites/libvirt-cim/cimtest/RASD/01_verify_rasd_fields.py	Mon Apr 07 02:26:13 2008 -0700
@@ -54,11 +54,12 @@ from XenKvmLib.test_doms import destroy_
 from XenKvmLib.test_doms import destroy_and_undefine_all
 import XenKvmLib
 from XenKvmLib import assoc
-from XenKvmLib.vxml import XenXML, KVMXML, get_class
+from XenKvmLib import vxml 
 from XenKvmLib.classes import get_typed_class
 from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
 verify_diskrasd_values, verify_memrasd_values 
 from CimTest.Globals import log_param, logger
+from CimTest.ReturnCodes import PASS, FAIL
 
 sup_types = ['Xen', 'KVM', 'XenFV']
 
@@ -66,7 +67,6 @@ test_vcpus  = 1
 test_vcpus  = 1
 test_mem    = 128
 test_mac    = "00:11:22:33:44:aa"
-test_disk   = 'xvda'
 
 def init_list(virt="Xen"):
     """
@@ -86,7 +86,7 @@ def init_list(virt="Xen"):
                 "CreationClassName": get_typed_class(virt, 'NetResourceAllocationSettingData')
                }
 
-    address = vsxml.xml_get_disk_source()
+    address = cxml.xml_get_disk_source()
     diskrasd = {
                 "InstanceID"  : '%s/%s' %(test_dom, test_disk), \
                 "ResourceType" : 17, \
@@ -133,28 +133,24 @@ def assoc_values(ip, assoc_info, virt="X
    
 @do_main(sup_types)
 def main():
-    global vsxml
+    global cxml
     options = main.options
     status = 0 
     rc = 1
     log_param()
     destroy_and_undefine_all(options.ip)
-    vsxml = get_class(options.virt)(test_dom, \
-                                    mem=test_mem, \
-                                    vcpus = test_vcpus, \
-                                    mac = test_mac, \
-                                    disk = test_disk)
-    try:
-        rc = vsxml.define(options.ip)
-        sc = vsxml.start(options.ip)
-        if rc == 0 or sc == 0:
-            logger.error("Define or start domain failed")
-            status = 1
-    except Exception, details:
-        logger.error("Unknonw exception happened")
-        logger.error("Exception : %s" % details)
-        status = 1
-   
+    global test_disk
+    if options.virt == 'Xen':
+        test_disk = 'xvda'
+    else:
+        test_disk = 'hda'
+
+    virt_xml = vxml.get_class(options.virt)
+    cxml = virt_xml(test_dom, mem=test_mem, vcpus = test_vcpus, mac = test_mac, disk = test_disk)
+    ret = cxml.define(options.ip)
+    if not ret:
+        logger.error('Unable to create domain %s' % test_dom)
+        return FAIL
     if status == 1: 
         destroy_and_undefine_all(options.ip)
         return 1
@@ -177,8 +173,8 @@ def main():
         status = 1 
     
     try:
-        vsxml.destroy(options.ip)
-        vsxml.undefine(options.ip)
+        cxml.destroy(options.ip)
+        cxml.undefine(options.ip)
     except Exception:
         logger.error("Destroy or undefine domain failed")
     return status




More information about the Libvirt-cim mailing list