From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXRqO-0001Pr-Su for qemu-devel@nongnu.org; Fri, 26 Sep 2014 05:29:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXRqI-0007dH-5N for qemu-devel@nongnu.org; Fri, 26 Sep 2014 05:29:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXRqH-0007cV-UK for qemu-devel@nongnu.org; Fri, 26 Sep 2014 05:29:34 -0400 From: Igor Mammedov Date: Fri, 26 Sep 2014 09:28:18 +0000 Message-Id: <1411723721-20484-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1411723721-20484-1-git-send-email-imammedo@redhat.com> References: <1411723721-20484-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v2 13/36] qdev: do not allow to instantiate non hotpluggable device with device_add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, mst@redhat.com, amit.shah@redhat.com, agraf@suse.de, borntraeger@de.ibm.com, kraxel@redhat.com, dmitry@daynix.com, pbonzini@redhat.com, rth@twiddle.net 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 --- qdev-monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 1.8.3.1