On Mon, Nov 11, 2024 at 09:53:08 +0100, Martin Kletzander wrote: > This should be better than the current for both hotplug: > > error: internal error: Invalid target model for serial device > > and hot-unplug: > > error: An error occurred, but the cause is unknown > > which should not be reached at all. > > Resolves: https://issues.redhat.com/browse/RHEL-66222 > Resolves: https://issues.redhat.com/browse/RHEL-66223 > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > --- > src/qemu/qemu_hotplug.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index 1a7b69e5bb44..f856e26c1877 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -2063,6 +2063,12 @@ qemuDomainAttachChrDevice(virQEMUDriver *driver, > bool need_release = false; > bool guestfwd = false; > > + if (qemuChrIsPlatformDevice(vmdef, chr)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", I'd suggest VIR_ERR_OPERATION_UNSUPPORTED instead. > + _("Cannot hotplug platform device")); > + return -1; > + } > + > if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) { > guestfwd = chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD; > > @@ -6049,6 +6055,12 @@ qemuDomainDetachDeviceChr(virQEMUDriver *driver, > goto cleanup; > } > > + if (qemuChrIsPlatformDevice(vmdef, tmpChr)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("Cannot detach platform device")); > + return -1; > + } > + > 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 || > -- > 2.47.0 >