[PATCH] virt: Fix issue #90 - MonitorSocketError installing SLES

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

 



Sometimes, before a KVM VM shuts down cleanly, a Monitor
connection reset error might happen, even though it's
not a fatal condition for the test. So, let's handle
better MonitorErrors happening during the unattended
install loop.

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

diff --git a/client/virt/tests/unattended_install.py b/client/virt/tests/unattended_install.py
index 95a11da..473c2db 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -4,7 +4,8 @@ import xml.dom.minidom
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
 from autotest_lib.client.virt import virt_vm, virt_utils, virt_http_server
-from autotest_lib.client.virt import libvirt_vm
+from autotest_lib.client.virt import libvirt_vm, kvm_monitor
+
 
 # Whether to print all shell commands called
 DEBUG = False
@@ -928,7 +929,9 @@ def run_unattended_install(test, params, env):
     while (time.time() - start_time) < install_timeout:
         try:
             vm.verify_alive()
-        except virt_vm.VMDeadError, e:
+        # Due to a race condition, sometimes we might get a MonitorError
+        # before the VM gracefully shuts down, so let's capture MonitorErrors.
+        except (virt_vm.VMDeadError, kvm_monitor.MonitorError), e:
             if params.get("wait_no_ack", "no") == "yes":
                 break
             else:
@@ -977,5 +980,9 @@ def run_unattended_install(test, params, env):
         shutdown_cleanly_timeout = int(params.get("shutdown_cleanly_timeout",
                                                   120))
         logging.info("Wait for guest to shutdown cleanly")
-        if virt_utils.wait_for(vm.is_dead, shutdown_cleanly_timeout, 1, 1):
-            logging.info("Guest managed to shutdown cleanly")
+        try:
+            if virt_utils.wait_for(vm.is_dead, shutdown_cleanly_timeout, 1, 1):
+                logging.info("Guest managed to shutdown cleanly")
+        except kvm_monitor.MonitorError, e:
+            logging.warning("Guest apparently shut down, but got a "
+                            "monitor error: %s", e)
-- 
1.7.7.5

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