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

# HG changeset patch # User Guolian Yun <yunguol@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@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

libvirt-cim-bounces@redhat.com wrote on 2008-04-21 16:52:39:
# HG changeset patch # User Guolian Yun <yunguol@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@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
Any comments?
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Guo Lian Yun wrote:
libvirt-cim-bounces@redhat.com wrote on 2008-04-21 16:52:39:
# HG changeset patch # User Guolian Yun <yunguol@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@cn.ibm.com>
Any comments?
No yet. The patch to fix the "Authorization" issue with indication_tester.py just went into the tree, and I just submitted another indication_tester.py patch today. I'd like for someone to patch the cimtest version of indication_tester and verify these patches work for them. If everything is working, I'll take a look at this patch. Sorry for the delay - without the indication_tester patches, I've been unable to test this on F9 / RHEL 5. Of course, everyone else is welcome to comment on all patches. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Guo Lian Yun wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1208767952 -28800 # Node ID 36ef9e7fdfc53a20e5a248257b57723ab8ae85dc # Parent 0d31dff13ae341fd6515dc844ee98c7b5300b71d [TEST] Update ComputerSystemIndication.01 for all three of lifecycle indications support
This test fails for me on F9. Here's the errors I see: F9 current sources: elm3b41.beaverton.ibm.com - - [25/Apr/2008 15:09:17] code 501, message Unsupported method ('GET') elm3b41.beaverton.ibm.com - - [25/Apr/2008 15:09:17] "GET /xend/node/ HTTP/1.1" 501 - ERROR - No valid indications received ERROR - Received indication error or wait too long ERROR - OSError : [Errno 3] No such process F9 release rpm: ERROR - BadStatusLine : Do you see either of these errors?
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
diff -r 0d31dff13ae3 -r 36ef9e7fdfc5 suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py
else: + # Create domain create_using_definesystem(test_dom, options.ip, None, None, options.virt)
I know this is existing code, but we should check to make sure the create call succeeds. If it fails, and indication won't be generated and we should return an error.
+ 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)])
Can you catch the return here to see if the modify succeeds?
+ 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):
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Guo Lian Yun
-
Kaitlin Rupert