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

[libvirt] [PATCH] Increase initial qemu monitor read timeout

See https://bugzilla.redhat.com/show_bug.cgi?id=453491

We've been getting bug reports like the above against virt-manager for a
while now: installing new VMs consistently throws an error 'Timed out
while reading monitor startup output'. The user can then just retry the
install and it will go off without a hitch.

I only just realized that the common thread between the reports is
physical install media: apparently the qemu monitor isn't too responsive
while it's waiting for a cold cd drive to spin up.

The attached patch jacks up the timeout from 3 seconds to 10 seconds
when doing the initial monitor read. I verified that this fixes the issue.

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 5ad60f1..0130d61 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -359,9 +359,9 @@ qemudReadMonitorOutput(virConnectPtr conn,
                        char *buf,
                        int buflen,
                        qemudHandlerMonitorOutput func,
-                       const char *what)
+                       const char *what,
+                       int timeout)
-#define MONITOR_TIMEOUT 3000
     int got = 0;
     buf[0] = '\0';
@@ -387,7 +387,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
                 return -1;
-            ret = poll(&pfd, 1, MONITOR_TIMEOUT);
+            ret = poll(&pfd, 1, timeout);
             if (ret == 0) {
                 qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  _("Timed out while reading %s startup output"), what);
@@ -421,7 +421,6 @@ qemudReadMonitorOutput(virConnectPtr conn,
                      _("Out of space while reading %s startup output"), what);
     return -1;
 static int
@@ -467,7 +466,7 @@ static int qemudOpenMonitor(virConnectPtr conn,
                                  driver, vm, monfd,
                                  buf, sizeof(buf),
-                                 "monitor");
+                                 "monitor", 10000);
     /* Keep monitor open upon success */
     if (ret == 0)
@@ -578,7 +577,7 @@ static int qemudWaitForMonitor(virConnectPtr conn,
                                      driver, vm, vm->stderr_fd,
                                      buf, sizeof(buf),
-                                     "console");
+                                     "console", 3000);
     buf[sizeof(buf)-1] = '\0';

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