[PATCH 1/4] KVM test: Avoid race condition on boot_savevm

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

 



As while loops termination conditions are checked at
the beginning of the loop, if we successfuly log onto
the vm on the last cycle, but the timeout happened
to be ended by then, we'd have a test failure.

So, introduce a variable that records whether the
test managed to log onto the VM, and use this variable
as the criteria for PASS/FAIL.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/tests/boot_savevm.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/tests/boot_savevm.py b/client/tests/kvm/tests/boot_savevm.py
index 91199fb..d02463d 100644
--- a/client/tests/kvm/tests/boot_savevm.py
+++ b/client/tests/kvm/tests/boot_savevm.py
@@ -21,6 +21,7 @@ def run_boot_savevm(test, params, env):
     savevm_login_delay = float(params.get("savevm_login_delay"))
     end_time = time.time() + float(params.get("savevm_timeout"))
 
+    successful_login = False
     while time.time() < end_time:
         time.sleep(savevm_delay)
         try:
@@ -46,10 +47,11 @@ def run_boot_savevm(test, params, env):
 
         try:
             vm.wait_for_login(timeout=savevm_login_delay)
+            successful_login = True
             break
         except Exception, detail:
             logging.debug(detail)
 
-    if (time.time() > end_time):
+    if not successful_login:
         raise error.TestFail("Not possible to log onto the vm after %s s" %
                              params.get("savevm_timeout"))
-- 
1.7.7.3

--
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