render / rpms / libvirt

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