From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1KPy-0004Bh-5A for qemu-devel@nongnu.org; Thu, 09 Jan 2014 13:33:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1KPp-0002Gt-NT for qemu-devel@nongnu.org; Thu, 09 Jan 2014 13:33:22 -0500 Received: from mail-ee0-x233.google.com ([2a00:1450:4013:c00::233]:65226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1KPp-0002Gk-Gc for qemu-devel@nongnu.org; Thu, 09 Jan 2014 13:33:13 -0500 Received: by mail-ee0-f51.google.com with SMTP id b15so1514260eek.10 for ; Thu, 09 Jan 2014 10:33:12 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52CEEB62.2000909@redhat.com> Date: Thu, 09 Jan 2014 19:33:06 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1389121639-17657-1-git-send-email-kroosec@gmail.com> <87a9f7c4d5.fsf@blackfin.pond.sub.org> <20140108171749.GB3717@Inspiron-3521> <52CD8C09.2070306@redhat.com> <20140109181821.GA4609@Inspiron-3521> In-Reply-To: <20140109181821.GA4609@Inspiron-3521> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qdev: Assign a default device ID when none is provided. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hani Benhabiles Cc: stefanha@redhat.com, Markus Armbruster , qemu-devel@nongnu.org, aliguori@amazon.com, imammedo@redhat.com, afaerber@suse.de Il 09/01/2014 19:18, Hani Benhabiles ha scritto: > On Wed, Jan 08, 2014 at 06:34:01PM +0100, Paolo Bonzini wrote: >> Il 08/01/2014 18:17, Hani Benhabiles ha scritto: >>> For this reason, the loop in assign_device_name() specifically check that the ID >>> doesn't exist already and uses the next value if it does. >>> >>> How would something like: >>> (qemu) device_add virtio-net-pci >>> ==> ID: virtio-net-pci.0 >>> >>> Be more problematic than: >>> (qemu) device_add virtio-net-pci,id=virtio-net-pci.0 >> >> (qemu) device_add virtio-net-pci >> (qemu) device_add virtio-net-pci,id=virtio-net-pci.0 >> >> works without your patches, fails with them (IIUC). > > It would fail with a clear and descriptive message (Duplicate ID) which is no > different than when a user uses tries to do so manually. It would still be a regression. > Without the patch, how does a user unplug a device for which he didn't specify > an ID (eg. forgotten, added quickly...) He doesn't. :) > It is even more confusing with other commands like info networks. > > (qemu) device_add virtio-net-pci > (qemu) device_add virtio-net-pci,id=foo > (qemu) info network > virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 > foo: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57 > (qemu) device_del foo > (qemu) device_del virtio-net-pci.0 > Device 'virtio-net-pci.0' not found This could be considered a bug in "info network" too. You might use a different template such as "unnamed virtio-net-pci #1" in net/net.c's assign_name. Paolo > If the naming scheme is an issue, could something like starting it with one or > two underscores better suited ? > > Cheers, > > Hani. > >