Console Char devices cannot be attached as qemuDomainChrRemove()
function suggests. After moved to async mode,
qemuDomainRemoveChrDevice() is not part of the removal process. So, we
need to check if device is able to be detached before calling removal
procedures.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1447183

Signed-off-by: Julio Faracco <jcfara...@gmail.com>
---
 src/qemu/qemu_hotplug.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f3c5f44a23..2c65df6d7b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5844,6 +5844,14 @@ qemuDomainDetachDeviceChr(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
+    if (tmpChr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
+        tmpChr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("detaching serial console is not supported"));
+        goto cleanup;
+    }
+
+
     /* guestfwd channels are not really -device rather than
      * -netdev. We need to treat them slightly differently. */
     guestfwd = tmpChr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to