Skip to content

Commit

Permalink
qdev: do not allow to instantiate non hotpluggable device with device…
Browse files Browse the repository at this point in the history
…_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>
  • Loading branch information
Igor Mammedov authored and afaerber committed Oct 15, 2014
1 parent 39b888b commit ce9835e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qdev-monitor.c
Expand Up @@ -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;
Expand Down

0 comments on commit ce9835e

Please sign in to comment.