render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
982648
From 8942f48f8ba0a7f3e68cf4a0c9b9ad5e1c35b88b Mon Sep 17 00:00:00 2001
982648
Message-Id: <8942f48f8ba0a7f3e68cf4a0c9b9ad5e1c35b88b@dist-git>
982648
From: Peter Krempa <pkrempa@redhat.com>
982648
Date: Fri, 17 Aug 2018 12:05:13 +0200
982648
Subject: [PATCH] qemu: hotplug: Fix asynchronous unplug of 'shmem'
982648
982648
commit 5c81c342a7 forgot to skip the detaching of the shmem backend
982648
when async unplug is requested which meant that we've tried to unplug
982648
the backend prior to delivery of the DEVICE_DELETED event.
982648
982648
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1618622
982648
982648
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
982648
(cherry picked from commit 69c20e1090059d8b359fdd435e8ba50db7269be1)
982648
https: //bugzilla.redhat.com/show_bug.cgi?id=1618680
982648
Reviewed-by: Erik Skultety <eskultet@redhat.com>
982648
---
982648
 src/qemu/qemu_hotplug.c | 11 ++++++++---
982648
 1 file changed, 8 insertions(+), 3 deletions(-)
982648
982648
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
982648
index 053ddb14ec..397a2bdde2 100644
982648
--- a/src/qemu/qemu_hotplug.c
982648
+++ b/src/qemu/qemu_hotplug.c
982648
@@ -5262,11 +5262,16 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
982648
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
982648
         goto cleanup;
982648
 
982648
-    if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
982648
-        ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
982648
+    if (async) {
982648
+        ret = 0;
982648
+    } else {
982648
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
982648
+            ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
982648
+    }
982648
 
982648
  cleanup:
982648
-    qemuDomainResetDeviceRemoval(vm);
982648
+    if (!async)
982648
+        qemuDomainResetDeviceRemoval(vm);
982648
     return ret;
982648
 }
982648
 
982648
-- 
982648
2.18.0
982648