From: Ryan Harper Date: Fri, 9 Apr 2010 13:07:16 +0000 (+0200) Subject: qemu: catch cdrom change error X-Git-Tag: v0.8.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a2dd00e76c0f56c3289860baf94393850e46d2f;p=thirdparty%2Flibvirt.git qemu: catch cdrom change error 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. * src/qemu/qemu_monitor_text.c: in qemuMonitorTextChangeMedia() look for failure to access the new data --- diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index e057bbea50..99427682e9 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -907,6 +907,13 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon, 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; cleanup: