9119d9
From de1a3fee51c281ff94db6aaffcb0cd57d09b326e Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <de1a3fee51c281ff94db6aaffcb0cd57d09b326e@dist-git>
9119d9
From: John Ferlan <jferlan@redhat.com>
9119d9
Date: Tue, 28 Oct 2014 22:28:47 -0400
9119d9
Subject: [PATCH] hotplug: Check for alias in chrdev detach
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1141621
9119d9
9119d9
If the QEMU_CAPS_DEVICE is set, then ensure the chr device alias has
9119d9
been properly set before making the calls to detach the device
9119d9
9119d9
(cherry picked from commit 4d8a4165a797a3c8a3dc46ceba28796f24e8ea78)
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 a7b0ec7..f1735d7 100644
9119d9
--- a/src/qemu/qemu_hotplug.c
9119d9
+++ b/src/qemu/qemu_hotplug.c
9119d9
@@ -3706,6 +3706,12 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
9119d9
         return ret;
9119d9
     }
9119d9
 
9119d9
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
9119d9
+        !tmpChr->info.alias) {
9119d9
+        if (qemuAssignDeviceChrAlias(vmdef, tmpChr, -1) < 0)
9119d9
+            return ret;
9119d9
+    }
9119d9
+
9119d9
     if (qemuBuildChrDeviceStr(&devstr, vm->def, chr, priv->qemuCaps) < 0)
9119d9
         return ret;
9119d9
 
9119d9
-- 
9119d9
2.1.3
9119d9