From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsIQs-00042e-JU for qemu-devel@nongnu.org; Mon, 07 Jan 2013 14:32:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsIQq-0004EM-DN for qemu-devel@nongnu.org; Mon, 07 Jan 2013 14:32:26 -0500 Received: from e9.ny.us.ibm.com ([32.97.182.139]:46068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsIQq-0004ED-9x for qemu-devel@nongnu.org; Mon, 07 Jan 2013 14:32:24 -0500 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Jan 2013 14:32:23 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id DBC9538C803F for ; Mon, 7 Jan 2013 14:32:20 -0500 (EST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r07JWK34305740 for ; Mon, 7 Jan 2013 14:32:20 -0500 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r07JW8xt026736 for ; Mon, 7 Jan 2013 12:32:09 -0700 From: Anthony Liguori In-Reply-To: <1355760006-891-1-git-send-email-borntraeger@de.ibm.com> References: <1355760006-891-1-git-send-email-borntraeger@de.ibm.com> Date: Mon, 07 Jan 2013 13:32:04 -0600 Message-ID: <874nisvlfv.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] qdev: obey no_user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: "qemu-devel@nongnu.org" Christian Borntraeger writes: > since > > commit 18b6dade8c0799c48f5c5e124b8c407cd5e22e96 > qdev: refactor device creation to allow bus_info to be set only in class > > A user can specify a device that is no_user. > For example on my i386 box, I can add a 2nd kvmvapic device. > > This patch checks for no-user and rejects the device_add. > > Signed-off-by: Christian Borntraeger I specifically broke this when QOM was introduced because no_user precludes a management tool from constructing a machine directlt. The real problem you're trying to solve is that it's an error to have two kvmvapic devices, not that users shouldn't be allowed to create them via -device. Regards, Anthony Liguori > --- > hw/qdev-monitor.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c > index a1b4d6a..b2c34e7 100644 > --- a/hw/qdev-monitor.c > +++ b/hw/qdev-monitor.c > @@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) > } > > k = DEVICE_CLASS(obj); > + if (k->no_user) { > + qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "a driver name"); > + error_printf_unless_qmp("Try with argument 'help' for a list.\n"); > + return NULL; > + } > > /* find bus */ > path = qemu_opt_get(opts, "bus"); > -- > 1.7.11.4