All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Hani Benhabiles <kroosec@gmail.com>
Cc: stefanha@redhat.com, Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, aliguori@amazon.com, imammedo@redhat.com,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH] qdev: Assign a default device ID when none is provided.
Date: Thu, 09 Jan 2014 19:33:06 +0100	[thread overview]
Message-ID: <52CEEB62.2000909@redhat.com> (raw)
In-Reply-To: <20140109181821.GA4609@Inspiron-3521>

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.
> 
> 

  reply	other threads:[~2014-01-09 18:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 19:07 [Qemu-devel] [PATCH] qdev: Assign a default device ID when none is provided Hani Benhabiles
2014-01-08  7:36 ` Markus Armbruster
2014-01-08 17:17   ` Hani Benhabiles
2014-01-08 17:34     ` Paolo Bonzini
2014-01-09 18:18       ` Hani Benhabiles
2014-01-09 18:33         ` Paolo Bonzini [this message]
2014-01-10  9:09           ` Markus Armbruster
2014-01-10  9:42             ` Andreas Färber
2014-01-10 11:54               ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CEEB62.2000909@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kroosec@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.