[Libvirt-cim] [PATCH] [TEST] Fixing the 06_paused_active_suspend.py tc of ComputerSystem

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Jul 10 15:46:41 UTC 2008


Deepti B. Kalakeri wrote:
> # HG changeset patch
> # User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
> # Date 1214925380 25200
> # Node ID 16bbf4d2f48e04334471805a524cfb653a391dd8
> # Parent  cc7716fa4252235924577a0e9bb16c89fc55870b
> [TEST] Fixing the 06_paused_active_suspend.py tc of ComputerSystem.

Sorry for the late review on this Deepti - there's a change that needs 
to be done in the provider (see the "For pause, reboot, and enable add 
support for guests in the NOSTATE state" thread).

> 
> 1) Updated the tc to use the poll_for_state_change() function.
> 2) Included the get_state_values() functions that returns the enable_state, req_state values.
> 3) Included the extra sleep bcs sometimes the provider is not
>    able to suspend the domain immediately even though the enable_state
>    is set to 2 and hence the tc was failing intermittently.

This sleep is not needed.  A provider change is needed so that the 
provider pauses the guest when the guest is in the "no sleep" state.

> 4) Removed  cxml.undefine() call since it was not req.
> 5) Fixed Indentation.
> 
> Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
> 
> ~
> 
> diff -r cc7716fa4252 -r 16bbf4d2f48e suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
> --- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py	Mon Jun 30 23:07:06 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py	Tue Jul 01 08:16:20 2008 -0700
> @@ -55,6 +55,7 @@ def main():
>              raise Exception('No cs instance returned')
>          for dom in cs:
>              if dom.Name == test_dom:
> +                Globals.logger.error("Deepti %s", dom.Name)

I think this is an extraneous debug statement. =)

>                  enabState = dom.EnabledState
>                  status = PASS
>                  break
> diff -r cc7716fa4252 -r 16bbf4d2f48e suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py

> -
>      except Exception, detail:
>          logger.error("Exception variable: %s" % detail)
>          return status
> + 
> +    status = poll_for_state_change(server, virt, test_dom, 
> +                                   START_STATE)
> +    from_State, req_state = get_state_values(server, virt)

Instead of getting the CS instance again in get_state_values(), what do 
you think about modifying poll_for_state() so that it returns the CS 
reference (since poll_for_state() has to get an instance to check the 
state value anyway).

It seems like this would be useful - in most cases, if you need to call 
poll_for_state(), you'll probably need the cs ref later on in the test case.

> 
> -    if enabledState != FINAL_STATE:
> -        logger.error("EnabledState has %i instead of %i", enabledState, FINAL_STATE)
> -        logger.error("Try to increase the timeout and run the test again")
> -
> +    if status != PASS or from_State == None or req_state == None:
> +        cxml.destroy(server)
> +        return status
> + 
> +    sleep(10)

This is not needed. The test case will fail until the provider fix is 
in, but it's fine to note that in the commit log.


-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list