[PATCH 5/5] qemu_hotplug: Deny live detach of <console/>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've tried, then I've tried even harder, but still wasn't able to
make sense of our console backcompat code in all its fine
details. Since I value my sanity, let's just forbid hotunplug of
<console/>, especially since detaching of corresponding <serial/>
works.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d9a102191f..5072798cb7 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5693,6 +5693,16 @@ qemuDomainDetachDeviceChr(virQEMUDriver *driver,
         goto cleanup;
     }
 
+    if (vmdef->os.type == VIR_DOMAIN_OSTYPE_HVM &&
+        tmpChr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
+        (tmpChr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL ||
+         tmpChr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)) {
+        /* Raise this limitation once device removal works. */
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("detaching of <console/> is unsupported. Try corresponding <serial/> instead"));
+        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.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux