9119d9
From cb0430d18f4c17369642a099ce865947c16c2d46 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <cb0430d18f4c17369642a099ce865947c16c2d46@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Tue, 28 Oct 2014 22:28:45 -0400
9119d9
Subject: [PATCH] hotplug: Check for alias in disk detach
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1141621
9119d9
9119d9
If the QEMU_CAPS_DEVICE is set, then ensure the disk device alias has
9119d9
been properly set in prior to making the calls to detach the device.
9119d9
9119d9
(cherry picked from commit 5d02a9a0c5b0d033cf1a68c004bf3cb290666fa8)
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_hotplug.c | 6 ++++++
9119d9
 1 file changed, 6 insertions(+)
9119d9
9119d9
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
9119d9
index e7aa2f0..246b4b9 100644
9119d9
--- a/src/qemu/qemu_hotplug.c
9119d9
+++ b/src/qemu/qemu_hotplug.c
9119d9
@@ -3008,6 +3008,12 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
9119d9
         }
9119d9
     }
9119d9
 
9119d9
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
9119d9
+        !detach->info.alias) {
9119d9
+        if (qemuAssignDeviceDiskAlias(vm->def, detach, priv->qemuCaps) < 0)
9119d9
+            goto cleanup;
9119d9
+    }
9119d9
+
9119d9
     qemuDomainMarkDeviceForRemoval(vm, &detach->info);
9119d9
 
9119d9
     qemuDomainObjEnterMonitor(driver, vm);
9119d9
-- 
9119d9
2.1.3
9119d9