]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qdev: do not allow to instantiate non hotpluggable device with device_add
authorIgor Mammedov <imammedo@redhat.com>
Fri, 26 Sep 2014 09:28:18 +0000 (09:28 +0000)
committerAndreas Färber <afaerber@suse.de>
Wed, 15 Oct 2014 03:03:13 +0000 (05:03 +0200)
It will allow explicitly mark device as not hotpluggable and
avoid its creation with following error at realize time
and destroying it afterwards anyway. Instead of it will
error out even before instance of device is created.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
qdev-monitor.c

index f6db4614763c6b3a9bd585b4a9cb897928d383d7..c72145127e673927a1735833e5507be18cfe1be8 100644 (file)
@@ -487,7 +487,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
     }
 
     dc = DEVICE_CLASS(oc);
-    if (dc->cannot_instantiate_with_device_add_yet) {
+    if (dc->cannot_instantiate_with_device_add_yet ||
+        (qdev_hotplug && !dc->hotpluggable)) {
         qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver",
                       "pluggable device type");
         return NULL;