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

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

 



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.

Thanks,
Cole
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;
 
-#undef MONITOR_TIMEOUT
 }
 
 static int
@@ -467,7 +466,7 @@ static int qemudOpenMonitor(virConnectPtr conn,
                                  driver, vm, monfd,
                                  buf, sizeof(buf),
                                  qemudCheckMonitorPrompt,
-                                 "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),
                                      qemudFindCharDevicePTYs,
-                                     "console");
+                                     "console", 3000);
 
     buf[sizeof(buf)-1] = '\0';
 
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]