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

Re: [libvirt] [RESEND][PATCH][QEMU driver] Catch cdrom change error



On Wed, Mar 31, 2010 at 12:22:50PM -0500, Ryan Harper wrote:
> Currently when we attempt to change the cdrom in a qemu VM the monitor
> doesn't generate an error if the target filename doesn't exist.  I've
> submitted a patch[1] for this.  This patch is the libvirt qemu-driver
> side which catches the error message from the monitor and reportes the
> error to libvirt.  This means that virsh attach-disk cdrom commands
> won't appear to succeed when qemu change command actually failed.
> 
> I've tested this patch on an older libvirt (rebuild libvirt-0.7.0 on my
> ubuntu host) but haven't rebuilt against git head since I can't
> quite compile that on my host.
> 
> 1. http://lists.gnu.org/archive/html/qemu-devel/2010-03/msg01935.html
> 
> Signed-off-by: Ryan Harper <ryanh us ibm com>
> 
> 
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 1596e59..f868907 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -905,7 +905,14 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
>          qemuReportError(VIR_ERR_OPERATION_FAILED,
>                          _("could not eject media on %s: %s"), devname, reply);
>          goto cleanup;
> -    }
> +    } 
> +
> +    /* Could not open message indicates bad filename */
> +    if (strstr(reply, "\nCould not open ")) {
> +        qemuReportError(VIR_ERR_OPERATION_FAILED,
> +                        _("could not change media on %s: %s"), devname, reply);
> +        goto cleanup;
> +    } 
> 
>      ret = 0;
> 
> 

  Okay, patch makes sense, applied, I just removed some spaces at end of
  line

    thanks !

Daniel

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


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