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

Re: [libvirt] [PATCH] qemu: Use log output for pty assignment if 'info chardev' is unavailable



On Sat, Jan 16, 2010 at 06:48:36PM +0100, Matthias Bolte wrote:
> 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 |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index d13119f..783d9fc 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -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);                                \


ACK, 


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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