From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYYhm-0004od-2k for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:01:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYYha-0004tj-Hq for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:01:22 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:44588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYYha-0004sp-BX for qemu-devel@nongnu.org; Mon, 29 Sep 2014 07:01:10 -0400 Received: by mail-wg0-f51.google.com with SMTP id b13so4069291wgh.34 for ; Mon, 29 Sep 2014 04:01:04 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54293B65.20403@redhat.com> Date: Mon, 29 Sep 2014 12:58:45 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1411723721-20484-1-git-send-email-imammedo@redhat.com> <1411723721-20484-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1411723721-20484-14-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [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: Igor Mammedov , qemu-devel@nongnu.org Cc: dmitry@daynix.com, borntraeger@de.ibm.com, mst@redhat.com, agraf@suse.de, amit.shah@redhat.com, kraxel@redhat.com, cornelia.huck@de.ibm.com, rth@twiddle.net Il 26/09/2014 11:28, Igor Mammedov ha scritto: > 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; > Reviewed-by: Paolo Bonzini