On Mon, 2010-10-18 at 18:51 +0800, Amos Kong wrote:
> Signed-off-by: Amos Kong <[email protected]>
> ---
>  0 files changed, 0 insertions(+), 0 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_test_utils.py 
> b/client/tests/kvm/kvm_test_utils.py
> index 585e194..da93be7 100644
> --- a/client/tests/kvm/kvm_test_utils.py
> +++ b/client/tests/kvm/kvm_test_utils.py
> @@ -44,7 +44,7 @@ def get_living_vm(env, vm_name):
>      return vm
>  
> 
> -def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2):
> +def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2, 
> serial=None):
>      """
>      Try logging into a VM repeatedly.  Stop on success or when timeout 
> expires.
>  
> @@ -54,8 +54,13 @@ def wait_for_login(vm, nic_index=0, timeout=240, start=0, 
> step=2):
>      @return: A shell session object.
>      """
>      logging.info("Trying to log into guest '%s', timeout %ds", vm.name, 
> timeout)

^ Move this message to the else clause below:

"Trying to log into guest %s using remote connection, timeout %ds", vm.name, 
timeout

> -    session = kvm_utils.wait_for(lambda: 
> vm.remote_login(nic_index=nic_index),
> -                                 timeout, start, step)
> +    if serial:
> +        logging.info("Try to log into guest by serial")

^ 1) The message needs to be consistent with the message we would use on
remote logins

"Trying to log into guest using serial connection, timeout %ds", timeout

> +        session = kvm_utils.wait_for(lambda: vm.serial_login(), timeout,
> +                                     start, step)
> +    else:
> +        session = kvm_utils.wait_for(lambda: vm.remote_login(
> +                  nic_index=nic_index), timeout, start, step)
>      if not session:
>          raise error.TestFail("Could not log into guest '%s'" % vm.name)
>      logging.info("Logged into guest '%s'" % vm.name)
> 

Also, this patch should convert all the nw tests that do call 

session = kvm_utils.wait_for(lambda: vm.remote_login(
                             nic_index=nic_index), timeout, start, step)

To use the new function. Also, would you rename the session variable to
session_serial in such cases, so it's more evident in tests what is the
type of session we're using to execute commands? Of course, we can
continue to name remote sessions as just 'session'.

Thanks!


_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to