Re: [Autotest] [PATCH 12/19] KVM test: Add new module kvm_test_utils.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux