From: Bjoern Walk Date: Fri, 8 Jul 2016 10:30:26 +0000 (+0200) Subject: qemu: hotplug: fix changeable media ejection X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6574a01a439cb86a2e53c72346ada8bc9033d140;p=libvirt.git qemu: hotplug: fix changeable media ejection Since return code is checked globally at the end of the function, let's make sure that we set it correctly at any point. This fixes a regression introduced in commit 0aa19f35 where the first command to eject changeable media would fail unconditionally. Signed-off-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e8a30d51bc..4e4bf820fd 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -240,7 +240,8 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, /* If the tray is present and tray change event is supported wait for it to open. */ if (diskPriv->tray && virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_TRAY_MOVED)) { - if (qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force) < 0) + rc = qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force); + if (rc < 0) goto error; } else { /* otherwise report possible errors from the attempt to eject the media*/