6ae9ed
From a38c567ff5d47e86e64d451da6a8715d667e3f2e Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <a38c567ff5d47e86e64d451da6a8715d667e3f2e@dist-git>
6ae9ed
From: Bjoern Walk <bwalk@linux.vnet.ibm.com>
6ae9ed
Date: Fri, 22 Jul 2016 13:50:59 +0200
6ae9ed
Subject: [PATCH] qemu: hotplug: fix changeable media ejection
6ae9ed
6ae9ed
Since return code is checked globally at the end of the function, let's
6ae9ed
make sure that we set it correctly at any point.
6ae9ed
6ae9ed
This fixes a regression introduced in commit 0aa19f35 where the first
6ae9ed
command to eject changeable media would fail unconditionally.
6ae9ed
6ae9ed
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
6ae9ed
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
6ae9ed
(cherry picked from commit 6574a01a439cb86a2e53c72346ada8bc9033d140)
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1359071
6ae9ed
6ae9ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_hotplug.c | 3 ++-
6ae9ed
 1 file changed, 2 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
6ae9ed
index 36885a3..4a56cad 100644
6ae9ed
--- a/src/qemu/qemu_hotplug.c
6ae9ed
+++ b/src/qemu/qemu_hotplug.c
6ae9ed
@@ -240,7 +240,8 @@ qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
6ae9ed
     /* If the tray is present and tray change event is supported wait for it to open. */
6ae9ed
     if (diskPriv->tray &&
6ae9ed
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_TRAY_MOVED)) {
6ae9ed
-        if (qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force) < 0)
6ae9ed
+        rc = qemuHotplugWaitForTrayEject(driver, vm, disk, driveAlias, force);
6ae9ed
+        if (rc < 0)
6ae9ed
             goto error;
6ae9ed
     } else  {
6ae9ed
         /* otherwise report possible errors from the attempt to eject the media*/
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed