+1.

Best,
Regards

Daisy (Ô˹úÁ«)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol@cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203



Kaitlin Rupert <kaitlin@linux.vnet.ibm.com>
Sent by: libvirt-cim-bounces@redhat.com

2008-12-24 05:53
Please respond to
List for discussion and development of libvirt CIM        <libvirt-cim@redhat.com>

To
libvirt-cim@redhat.com
cc
Subject
[Libvirt-cim] [PATCH] [TEST] Update CS 04_defineStartVS.py to use        cim_start()





# HG changeset patch
# User Kaitlin Rupert <karupert@us.ibm.com>
# Date 1230069082 28800
# Node ID 660adffeba4f0bc2b9d54f8b5c750fbc623ca791
# Parent  10588b983902335403bb3c40d60b9064d77020ce
[TEST] Update CS 04_defineStartVS.py to use cim_start().

Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>

diff -r 10588b983902 -r 660adffeba4f suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py                 Tue Dec 23 13:23:04 2008 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/04_defineStartVS.py                 Tue Dec 23 13:51:22 2008 -0800
@@ -30,11 +30,8 @@
#                                                             10-Oct-2007

import sys
-from time import sleep
-from XenKvmLib import vxml
-from XenKvmLib import enumclass
-from CimTest import Globals, CimExt
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.vxml import get_class
+from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL

@@ -45,53 +42,26 @@
def main():
    options = main.options
    status = FAIL
-    enabState = 0

-    cxml = vxml.get_class(options.virt)(test_dom)
-    cxml.cim_define(options.ip)
-    ret = cxml.start(options.ip)
+    cxml = get_class(options.virt)(test_dom)
+    try:
+        ret = cxml.cim_define(options.ip)
+        if not ret:
+            logger.error("Unable to define %s" % test_dom)
+            return FAIL
+
+        status = cxml.cim_start(options.ip)
+        if status != PASS:
+            logger.error("Failed to Start the dom: %s" % test_dom)
+            logger.error("Property values not set properly for %s", test_dom)
   
-    if not ret :
-        Globals.logger.error("Failed to Start the dom: %s", test_dom)
-        cxml.undefine(options.ip)
-        return status
-    
-    timeout = 10
-    try:
-        # Need to poll for XenFV, since enabState is not getting set
-        # otherwise.
-        for i in range(1, (timeout + 1)):
-            sleep(1)
-            cs_class = get_typed_class(options.virt, 'ComputerSystem')
-            keys = {
-                    'Name' : test_dom,
-                    'CreationClassName' : cs_class
-                   }
-            cs = enumclass.GetInstance(options.ip, cs_class, keys)
-            if cs.Name != test_dom:
-                Globals.logger.error("VS %s is not defined" % test_dom)
-                break  
-
-            # Success: VS is in Enabled State after Define and Start
-            enabState = cs.EnabledState
-            if enabState == 2:
-                status = PASS
-                break
-
    except Exception, detail:
-        Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE,
-                             get_typed_class(options.virt, 'ComputerSystem'))
-        Globals.logger.error("Exception: %s", detail)
-        cxml.destroy(options.ip)
-        cxml.undefine(options.ip)
-        return status
-
-    if status != PASS :
-        Globals.logger.error("Error: property values are not set for VS %s",
-                                                                   test_dom)
+        logger.error("Exception: %s", detail)
+        status = FAIL

    cxml.destroy(options.ip)
    cxml.undefine(options.ip)
+
    return status

if __name__ == "__main__":

_______________________________________________
Libvirt-cim mailing list
Libvirt-cim@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim