Received: from eggs.gnu.org ([2001:4830:134:3::10]:37206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeEy1-0005zf-6W for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeExs-0004lM-Vi for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:36 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49325 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeExs-0004kO-Ol for qemu-devel@nongnu.org; Tue, 14 Oct 2014 23:09:28 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 15 Oct 2014 05:08:52 +0200 Message-Id: <1413342561-4754-19-git-send-email-afaerber@suse.de> In-Reply-To: <1413342561-4754-1-git-send-email-afaerber@suse.de> References: <1413342561-4754-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 18/47] 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: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov 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 Reviewed-by: Paolo Bonzini Signed-off-by: Andreas F=C3=A4rber --- 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) } =20 dc =3D 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; --=20 1.8.4.5