summaryrefslogtreecommitdiffstats
path: root/qdev-monitor.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-09-26 09:28:18 +0000
committerAndreas Färber <afaerber@suse.de>2014-10-15 05:03:13 +0200
commitce9835e00df65bf5beb6c094c0865d8e60018310 (patch)
tree7fe485b0a2eba0916ae77ae2f8291c9190474dae /qdev-monitor.c
parent39b888bd88296b178082b5a2e4c6e82fcbd877f8 (diff)
downloadhqemu-ce9835e00df65bf5beb6c094c0865d8e60018310.zip
hqemu-ce9835e00df65bf5beb6c094c0865d8e60018310.tar.gz
qdev: do not allow to instantiate non hotpluggable device with device_add
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>
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r--qdev-monitor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c
index f6db461..c721451 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -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;
OpenPOWER on IntegriCloud