[Libvirt-cim] [PATCH] [TEST] Update ComputerSystemIndication.01 for all three of lifecycle indications support

Guo Lian Yun yunguol at cn.ibm.com
Mon Apr 21 08:52:39 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1208767952 -28800
# Node ID 36ef9e7fdfc53a20e5a248257b57723ab8ae85dc
# Parent  0d31dff13ae341fd6515dc844ee98c7b5300b71d
[TEST] Update ComputerSystemIndication.01 for all three of lifecycle indications support

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

diff -r 0d31dff13ae3 -r 36ef9e7fdfc5 suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py
--- a/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py	Fri Apr 18 17:00:16 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py	Mon Apr 21 16:52:32 2008 +0800
@@ -28,14 +28,16 @@
 from CimTest.Globals import do_main
 from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib.common_util import create_using_definesystem 
-from XenKvmLib.test_doms import undefine_test_domain
 from XenKvmLib.classes import get_typed_class
+from XenKvmLib import vsms
+from XenKvmLib import vxml
 from XenKvmLib.indication_tester import CIMIndicationSubscription
 from XenKvmLib.vxml import set_default
 
 SUPPORTED_TYPES = ['Xen', 'XenFV', 'KVM']
 
 test_dom = "domU"
+nmem = 64
 
 @do_main(SUPPORTED_TYPES)
 def main():
@@ -44,8 +46,13 @@
     status = FAIL
 
     dict = set_default(options.ip)
-    indication_name = get_typed_class(options.virt, 'ComputerSystemCreatedIndication')
-    
+
+    created_indication = get_typed_class(options.virt, 'ComputerSystemCreatedIndication')
+    modified_indication = get_typed_class(options.virt, 'ComputerSystemModifiedIndication')
+    deleted_indication = get_typed_class(options.virt, 'ComputerSystemDeletedIndication')
+    indication_list = [created_indication, modified_indication, deleted_indication]
+
+    indication_name = "CIM_Indication"
     sub = CIMIndicationSubscription(dict['default_name'], indication_name, dict['default_ns'],
                                     dict['default_print_ind'], dict['default_sysname'])
     sub.subscribe(dict['default_url'], dict['default_auth'])
@@ -55,16 +62,36 @@
         pid = os.fork()
         if pid == 0:
             sub.server.handle_request() 
-            if len(sub.server.indications) == 0:
+            if len(sub.server.indications) != 3: 
                 logger.error("No valid indications received")
                 sys.exit(1)
-            elif str(sub.server.indications[0]) != indication_name:
-                logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[0])))
-                sys.exit(2)
+            elif len(sub.server.indications) == 3:
+                for i in range(0, 3): 
+		    if str(sub.server.indications[i]) not in indication_list:
+                        logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[i])))
+                        sys.exit(2)
             else:
                 sys.exit(0)
         else:
+            # Create domain
             create_using_definesystem(test_dom, options.ip, None, None, options.virt)
+            time.sleep(10)
+
+            # Modify mem settings
+            service = vsms.get_vsms_class(options.virt)(options.ip)
+            cxml = vxml.get_class(options.virt)(test_dom)
+            masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=test_dom)
+            service.ModifyResourceSettings(ResourceSettings=[str(masd)])
+            cxml.dumpxml(options.ip)
+            mem = cxml.xml_get_mem()
+            if mem != '%i' % (nmem * 1024):
+                logger.error('Error changing rs for mem')
+            time.sleep(10)
+
+            # Delete domain
+            cxml.destroy(options.ip)
+            cxml.undefine(options.ip) 
+             
             for i in range(0,100):
                 pw = os.waitpid(pid, os.WNOHANG)[1]
                 if pw == 0:
@@ -84,7 +111,6 @@
     sub.unsubscribe(dict['default_auth'])
     logger.info("Cancelling subscription for %s" % indication_name)
     os.kill(pid, signal.SIGKILL)
-    undefine_test_domain(test_dom, options.ip, options.virt)
 
     return status
 




More information about the Libvirt-cim mailing list