Re: [libvirt] [PATCH] Fix detection of errors in QEMU device_add command

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

 



On Tue, Mar 02, 2010 at 05:18:42PM +0000, Daniel P. Berrange wrote:
> The code assumed that 'device_add' returned an empty string upon
> success. This is not true, it sometimes prints random debug info.
> THus we need to check for an explicit fail string
> 
> * src/qemu/qemu_monitor_text.c: Fix error checking of the device_add
>   monitor command
> ---
>  src/qemu/qemu_monitor_text.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 7604ae8..c60e840 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -2122,9 +2122,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
>          goto cleanup;
>      }
>  
> -    if (STRNEQ(reply, "")) {
> +    /* If the command failed qemu prints:
> +     * Could not add ... */
> +    if (strstr(reply, "Could not add ")) {
>          qemuReportError(VIR_ERR_OPERATION_FAILED,
> -                        _("adding %s device failed: %s"), devicestr, reply);
> +                        _("adding %s device failed"), devicestr);
>          goto cleanup;
>      }
>  

 ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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