From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uri Lublin Subject: Re: [Autotest] [PATCH 12/19] KVM test: Add new module kvm_test_utils.py Date: Mon, 14 Sep 2009 10:58:01 +0300 Message-ID: <4AADF789.9050603@redhat.com> References: <1252519932-30733-3-git-send-email-mgoldish@redhat.com> <1252519932-30733-4-git-send-email-mgoldish@redhat.com> <1252519932-30733-5-git-send-email-mgoldish@redhat.com> <1252519932-30733-6-git-send-email-mgoldish@redhat.com> <1252519932-30733-7-git-send-email-mgoldish@redhat.com> <1252519932-30733-8-git-send-email-mgoldish@redhat.com> <1252519932-30733-9-git-send-email-mgoldish@redhat.com> <1252519932-30733-10-git-send-email-mgoldish@redhat.com> <1252519932-30733-11-git-send-email-mgoldish@redhat.com> <1252519932-30733-12-git-send-email-mgoldish@redhat.com> <20090914052644.GA2476@aFu.nay.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Michael Goldish , kvm@vger.kernel.org To: Yolkfull Chow Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53153 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbZINIAQ (ORCPT ); Mon, 14 Sep 2009 04:00:16 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8E80KhW003351 for ; Mon, 14 Sep 2009 04:00:20 -0400 In-Reply-To: <20090914052644.GA2476@aFu.nay.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/14/2009 08:26 AM, Yolkfull Chow wrote: > On Wed, Sep 09, 2009 at 09:12:05PM +0300, Michael Goldish wrote: >> This module is meant to reduce code size by performing common test procedures. >> Generally, code here should look like test code. >> +def wait_for_login(vm, nic_index=0, timeout=240): >> + """ >> + Try logging into a VM repeatedly. Stop on success or when timeout expires. >> + >> + @param vm: VM object. >> + @param nic_index: Index of NIC to access in the VM. >> + @param timeout: Time to wait before giving up. >> + @return: A shell session object. >> + """ >> + logging.info("Waiting for guest to be up...") >> + session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index), >> + timeout, 0, 2) >> + if not session: >> + raise error.TestFail("Could not log into guest") > > Hi Michael, I think we should also add a parameter 'vm_name' for > wait_for_login(). On the assumption that we boot more than one VMs, it's > hard to know which guest failed to login according to message above. > What do you think? :-) > The VM object ("vm" parameter) "knows" its own name. It is a good idea to add that name to log/error messages, since we do want to run different tests (VMs) in parallel (although the logs should be also saved in different directories/files). Regards, Uri.