]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: hotplug: fix changeable media ejection
authorBjoern Walk <bwalk@linux.vnet.ibm.com>
Fri, 8 Jul 2016 10:30:26 +0000 (12:30 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 22 Jul 2016 10:50:32 +0000 (06:50 -0400)
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 <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
src/qemu/qemu_hotplug.c

index e8a30d51bcb08704b396d1254261b577fc631061..4e4bf820fd83354a6e31545eb3875c21831309bd 100644 (file)
@@ -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*/