[PATCH] [TEST] Fixing 06_paused_active_suspend.py tc of ComputerSystem

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1213968570 25200 # Node ID 92675efb0941a25500820ccfde0a7d73d6058acc # Parent 1837fcafef1281396deb7d03f6754da320af8a36 [TEST] Fixing 06_paused_active_suspend.py tc of ComputerSystem. 1) Included the poll method since the enabledState was not getting set for XenFV appropriately. 2) Included the bugno["0001"], since RequestStateChange() method was not able to suspend a XenFV domain even when it was in a expected running state. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 1837fcafef12 -r 92675efb0941 suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py --- a/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Fri Jun 20 05:58:16 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Fri Jun 20 06:29:30 2008 -0700 @@ -48,7 +48,7 @@ from XenKvmLib.test_doms import destroy_ from XenKvmLib.test_doms import destroy_and_undefine_all from CimTest.Globals import logger from CimTest.Globals import do_main -from XenKvmLib.common_util import call_request_state_change +from XenKvmLib.common_util import call_request_state_change, get_cs_instance from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC sup_types = ['Xen', 'KVM', 'XenFV'] @@ -56,94 +56,102 @@ mem = 128 # MB mem = 128 # MB # Keeping the bug no for future reference # bug_no_req_change_method = "90559" +bug_no_req_method = "00001" bug_no_req_change_prop = "00002" START_STATE = 2 FINAL_STATE = 9 REQUESTED_STATE = FINAL_STATE TIME = "00000000000000.000000:000" -@do_main(sup_types) -def main(): - options = main.options +def check_attributes(server, virt, cxml, verify_state): + enabledState = RequestedState = None status = FAIL - - cxml = vxml.get_class(options.virt)(test_dom, mem) - -#Create VS - try: - ret = cxml.create(options.ip) - if not ret: - logger.error("ERROR: VS %s was not created" % test_dom) - return status - cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom) - if cs.Name == test_dom: - from_State = cs.EnabledState - else: - logger.error("ERROR: VS %s not found" % test_dom) - return status - except Exception, detail: - logger.error("Exception variable: %s" % detail) - cxml.destroy(options.ip) - cxml.undefine(options.ip) - return status - -#Suspend the VS - rc = call_request_state_change(test_dom, options.ip, REQUESTED_STATE, - TIME, options.virt) - if rc != 0: - logger.error("Unable to suspend dom %s using RequestedStateChange()", test_dom) - cxml.destroy(options.ip) - cxml.undefine(options.ip) - return status -#Polling for the value of EnabledState to be set to 9. -#We need to wait for the EnabledState to be set appropriately since -#it does not get set immediatley to value of 9 when suspended. timeout = 10 try: - for i in range(1, (timeout + 1)): sleep(1) - cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom) - if cs.Name == test_dom: - to_RequestedState = cs.RequestedState - enabledState = cs.EnabledState - else: - logger.error("VS %s not found" % test_dom) - return status - if enabledState == FINAL_STATE: + status, cs = get_cs_instance(test_dom, server, virt) + if status != PASS: + cxml.destroy(server) + cxml.undefine(server) + return status, enabledState, RequestedState + + enabledState = cs.EnabledState + RequestedState = cs.RequestedState + + if enabledState == verify_state: status = PASS break except Exception, detail: logger.error("Exception variable: %s" % detail) - return status + cxml.destroy(server) + cxml.undefine(server) + return status, enabledState, RequestedState - if enabledState != FINAL_STATE: - logger.error("EnabledState has %i instead of %i", enabledState, FINAL_STATE) + if enabledState != verify_state: + logger.error("EnabledState has %i instead of %i", enabledState, + verify_state) logger.error("Try to increase the timeout and run the test again") if status != PASS: - ret = cxml.destroy(options.ip) - cxml.undefine(options.ip) + cxml.destroy(server) + cxml.undefine(server) + return status, enabledState, RequestedState + +@do_main(sup_types) +def main(): + options = main.options + server = options.ip + virt = options.virt + + #Create VS + cxml = vxml.get_class(virt)(test_dom, mem) + ret = cxml.create(server) + if not ret: + logger.error("ERROR: VS %s was not created" % test_dom) return status -# Success: -# if -# From state == 9 -# To state == 2 -# Enabled_state == RequestedState + status, from_State, req_state = check_attributes(server, virt, cxml, + START_STATE) + if status != PASS: + return status + + #Suspend the VS + status = call_request_state_change(test_dom, server, REQUESTED_STATE, + TIME, virt) + if status != PASS: + logger.error("Unable to suspend dom '%s' using RequestedStateChange()", + test_dom) + cxml.destroy(server) + cxml.undefine(server) + status = XFAIL_RC(bug_no_req_method) + return status + + status, enabledState, to_RequestedState = check_attributes(server, + virt, cxml, + FINAL_STATE) + if status != PASS: + return status + + # Success: + # if + # From state == 9 + # To state == 2 + # Enabled_state == RequestedState if from_State == START_STATE and \ to_RequestedState == FINAL_STATE and \ enabledState == to_RequestedState: status = PASS else: - logger.error("ERROR: VS %s transition from suspend State to Activate state \ - was not Successful" % test_dom) -# Replace the status with FAIL once the bug is fixed. + logger.error("VS '%s' transition from suspend State to Activate " + "state was not Successful" % test_dom) + # Replace the status with FAIL once the bug is fixed. status = XFAIL_RC(bug_no_req_change_prop) - ret = cxml.destroy(options.ip) - cxml.undefine(options.ip) + + ret = cxml.destroy(server) + cxml.undefine(server) return status if __name__ == "__main__":

Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1213968570 25200 # Node ID 92675efb0941a25500820ccfde0a7d73d6058acc # Parent 1837fcafef1281396deb7d03f6754da320af8a36 [TEST] Fixing 06_paused_active_suspend.py tc of ComputerSystem.
1) Included the poll method since the enabledState was not getting set for XenFV appropriately. 2) Included the bugno["0001"], since RequestStateChange() method was not able to suspend a XenFV domain even when it was in a expected running state.
Bug #0001 is related to a problem where a <bootloader /> was being appended to a guest's XML. If you do a dumpxml of the guest created by the test (do a dumpxml after the guest is running), you won't see such a tag. What's happening here is that the FV guest will sometimes return "no state" instead of running of blocked. The provider won't pause the guest unless it's in the running or the blocked state. I modified state_change_pause() so that virDomainSuspend() is called if the state is VIR_DOMAIN_NOSTATE. virDomainSuspend() doesn't return an error if the state is VIR_DOMAIN_NOSTATE. I'm wondering if the guest is running by the time virDomainSuspend(). We do have a check there so if virDomainSuspend() does fail, we return an error. So this might be a reasonable approach here. Dan - any thoughts on this? -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Deepti B. Kalakeri
-
Kaitlin Rupert