From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35761 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJR9C-0007lr-EU for qemu-devel@nongnu.org; Tue, 01 Jun 2010 09:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJR9B-00061J-4q for qemu-devel@nongnu.org; Tue, 01 Jun 2010 09:04:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31516) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJR9A-00061E-SN for qemu-devel@nongnu.org; Tue, 01 Jun 2010 09:04:45 -0400 Date: Tue, 1 Jun 2010 10:04:34 -0300 From: Luiz Capitulino Message-ID: <20100601100434.380c6ab3@redhat.com> In-Reply-To: References: <3715da16813f7cdcb7ec023167a84a94e8a37089.1274612367.git.jan.kiszka@web.de> <4C021ED5.1080703@redhat.com> <4C038882.3080007@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] qdev: Reject duplicate and anti-social device IDs List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Anthony Liguori , Juan Quintela , Jan Kiszka , qemu-devel@nongnu.org, Blue Swirl , Jan Kiszka , Gerd Hoffmann , Avi Kivity On Mon, 31 May 2010 16:13:12 +0200 Markus Armbruster wrote: > We need Device IDs to be unique and not contain '/' so device tree > nodes can always be unambigously referenced by tree path. > > We already have some protection against duplicate IDs, but it got > holes: > > * We don't assign IDs to default devices. > > * -device and device_add use the ID of a qemu_device_opts. Which > rejects duplicate IDs. > > * pci_add nic -net use either the ID or option "name" of > qemu_net_opts. And there's our hole. Reproducible with "-net user > -net nic,id=foo -device lsi,id=foo". Two bugs that might not be related to this thread: * "id" member is not mandatory for the device_add command: { "execute": "device_add", "arguments": { "driver": "e1000" } } {"return": {}} * "id" member remains in use when the netdev_add command fails: { "execute": "netdev_add", "arguments": { "id": "foobar" } } {"error": {"class": "MissingParameter", "desc": "Parameter 'type' is missing", "data": {"name": "type"}}} { "execute": "netdev_add", "arguments": { "type": "user", "id": "foobar" } } {"error": {"class": "DuplicateId", "desc": "Duplicate ID 'foobar' for netdev", "data": {"object": "netdev", "id": "foobar"}}}