]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Use log output for pty assignment if 'info chardev' is unavailable
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 16 Jan 2010 17:32:56 +0000 (18:32 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 18 Jan 2010 00:54:40 +0000 (01:54 +0100)
qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
provide information for a requested device, even if the log output parsing
had found the pty path for that device. This makes pty assignment fail for
older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
information and the hash for device-id-to-pty-path mapping stays empty.

Make qemudFindCharDevicePTYsMonitor report an error only if the log output
parsing and the 'info chardev' parsing failed to provide the pty path.

src/qemu/qemu_driver.c

index d13119ff9a3ff3abc73dca67043e273c73d0a443..783d9fc9ca1c6ce97760cd877765c4d17e8594c6 100644 (file)
@@ -1428,9 +1428,17 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
                                                                           \
             const char *path = (const char *) virHashLookup(paths, id);   \
             if (path == NULL) {                                           \
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,\
-                                 _("no assigned pty for device %s"), id); \
-                return -1;                                                \
+                if (chr->data.file.path == NULL) {                        \
+                    /* neither the log output nor 'info chardev' had a */ \
+                    /* pty path for this chardev, report an error */      \
+                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
+                                     _("no assigned pty for device %s"), id);  \
+                    return -1;                                                 \
+                } else {                                                  \
+                    /* 'info chardev' had no pty path for this chardev, */\
+                    /* but the log output had, so we're fine */           \
+                    continue;                                             \
+                }                                                         \
             }                                                             \
                                                                           \
             VIR_FREE(chr->data.file.path);                                \