From: "Daniel P. Berrange" <berrange@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
jsnow@redhat.com, "Jeff Cody" <jcody@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"qemu-devel qemu-devel" <qemu-devel@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] Should we auto-generate IDs?
Date: Thu, 27 Aug 2015 17:22:19 +0100 [thread overview]
Message-ID: <20150827162219.GC24486@redhat.com> (raw)
In-Reply-To: <868FF75F-04AA-40CB-84D5-A4DFB3D06749@gmail.com>
On Thu, Aug 27, 2015 at 12:08:25PM -0400, Programmingkid wrote:
>
> On Aug 27, 2015, at 12:02 PM, Daniel P. Berrange wrote:
>
> > On Thu, Aug 27, 2015 at 11:58:22AM -0400, Programmingkid wrote:
> >>
> >> On Aug 27, 2015, at 11:40 AM, Jeff Cody wrote:
> >>
> >>> On Thu, Aug 27, 2015 at 11:20:20AM -0400, Programmingkid wrote:
> >>>>
> >>>> On Aug 27, 2015, at 10:42 AM, Daniel P. Berrange wrote:
> >>>>
> >>>>> On Thu, Aug 27, 2015 at 10:34:05AM -0400, Programmingkid wrote:
> >>>>>>
> >>>>>> On Aug 27, 2015, at 10:02 AM, Eric Blake wrote:
> >>>>>>
> >>>>>>> On 08/27/2015 07:56 AM, Programmingkid wrote:
> >>>>>>>
> >>>>>>>>> If we did have auto-generated names, we would need to come up with a
> >>>>>>>>> scheme that is not going to clash with any existing naming that users
> >>>>>>>>> of QEMU may already be doing, otherwise we risk causing a regression.
> >>>>>>>>> Something as simple as what you suggest has non-trivial chance of
> >>>>>>>>> clashing.
> >>>>>>>>
> >>>>>>>> Actually there is a way to prevent clashing. When QEMU auto-generates a
> >>>>>>>> name, it could scan all the ID's to see if there is a clash. If the ID is already
> >>>>>>>> taken, just increment the ID until it is detected to be unique. The previous
> >>>>>>>> threads on this subject has patches that did just that. This means that a
> >>>>>>>> ID scheme that is just a single number would work without clashes.
> >>>>>>>
> >>>>>>> No, because you cannot predict what FUTURE names the user will request.
> >>>>>>> The name generated by qemu must be IMPOSSIBLE to request manually, and
> >>>>>>> not just one that happens not to clash at the current moment.
> >>>>>>
> >>>>>> If I add a device with an ID that is taken, QEMU can just say sorry that ID is already
> >>>>>> taken. I could just increment the ID myself until I find one that is unique. It is a
> >>>>>> simple algorithm. Maybe you are talking about some program that has hard coded
> >>>>>> ID's it depends on. If that is the case, perhaps this management program could be
> >>>>>> made to be a little flexible. Or use a 160-bit SHA-1 generated ID that is virtually
> >>>>>> guaranteed to always be unique.
> >>>>>
> >>>>> If breaking existing apps was OK, we would just mandate that users always
> >>>>> provide an ID which trivially avoids the problem of not having an ID to
> >>>>> use when deleting the object. We want to /avoid/ breaking existing apps
> >>>>> though, so saying an app should change the way it works in order to cope
> >>>>> with QEMU's ID generation is not appropriate. Hence any use of auto-generated
> >>>>> IDs, must use a separate namespace to avoid such clashes.
> >>>>
> >>>> This is making the assumption that an auto-generated ID system would break any existing
> >>>> application. We don't know this. In fact, I predict a future patch would allow existing
> >>>> applications to continue running without modification. The patch would be a win-win
> >>>> for both users and any management application.
> >>>>
> >>>
> >>> Daniel's assumption is spot on. The idea of "QEMU can just say sorry
> >>> that ID is already taken" will break existing applications.
> >>>
> >>> But we are all striving to make your prediction true, with this very
> >>> conversation.
> >>
> >> Ok, it sounds like some are concerned that Libvirt would not be able to work with this
> >> feature. Let me ask you this: does Libvirt interact with QEMU before the user has a
> >> chance to do so? If the answer is yes, then that means Libvirt will have finished
> >> creating all its devices with their ID's long before the user has a chance to enter
> >> his own devices.
> >
> > Just to be clear - libvirt will *never* use an auto-generated device
> > IDs feature. It is way more complicated to let QEMU assign device IDs
> > and then auto-detect them from some 'info device-list' output, than
> > to just specify IDs upfront at device/object creation time which
> > it already does[1]. There is simply no benefit to auto-generating device
> > IDs for a mgmt app like libvirt, and plenty of downside. Auto-generated
> > IDs will only be of interest to humans talking to the monitor directly
> > without a mgmt app involved.
>
> I've haven't used Libvirt but I do believe in the saying "never say never". The
> rest of what you said does sound accurate.
I say that based on history of the development of libvirt. Many, many
years ago now, with QEMU 0.8.x, -device / device_add did not exist,
so you had to configure devices using args like -drive, or before
that, -hda, -hdb, etc. With that old syntax, QEMU would in fact
auto-generate a unique ID for each device. Libvirt then had to
figure out what that unique ID would be which was non-trivial to
get right, and risked changing with new QEMU releases. It also
did not cope well when hotplug was combined with migraiton, as
two guest machines with identical guest hardware could have
different assigned IDs depending on the sequence of hotplug/unplug
operations performed. All in all it was a world of hurt and
we were very happy when -device came along and allowed libvirt
to specify the deivce IDs upfront itself. So yes, I am confident
we will not go back to letting QEMU auto-generate IDs in libvirt.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2015-08-27 16:22 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 18:53 [Qemu-devel] [PATCH] qdev-monitor.c: Add device id generation Programmingkid
2015-08-24 22:21 ` Eric Blake
2015-08-25 12:42 ` Markus Armbruster
2015-08-25 15:25 ` Programmingkid
2015-08-25 15:33 ` Peter Maydell
2015-08-25 15:50 ` Programmingkid
2015-08-25 18:30 ` Markus Armbruster
2015-08-25 19:05 ` Programmingkid
2015-08-25 14:33 ` Programmingkid
2015-08-25 12:38 ` [Qemu-devel] Should we auto-generate IDs? (was: [PATCH] qdev-monitor.c: Add device id generation) Markus Armbruster
2015-08-25 15:15 ` Programmingkid
2015-08-26 14:52 ` Programmingkid
2015-08-26 16:31 ` [Qemu-devel] Should we auto-generate IDs? Markus Armbruster
2015-08-26 17:16 ` Programmingkid
2015-08-26 18:45 ` Peter Maydell
2015-08-26 21:48 ` Programmingkid
2015-08-26 22:08 ` John Snow
2015-08-27 3:40 ` Programmingkid
2015-08-27 5:39 ` Markus Armbruster
2015-08-27 15:39 ` Programmingkid
2015-08-26 17:25 ` Jeff Cody
2015-08-26 17:29 ` Programmingkid
2015-08-26 18:08 ` Jeff Cody
2015-08-26 18:17 ` Programmingkid
2015-08-26 22:01 ` Jeff Cody
2015-08-26 22:04 ` John Snow
2015-08-27 3:26 ` Programmingkid
2015-08-27 3:22 ` Programmingkid
2015-08-27 12:32 ` Jeff Cody
2015-08-27 13:00 ` Eric Blake
2015-08-27 13:39 ` Programmingkid
2015-08-27 13:51 ` Daniel P. Berrange
2015-08-27 14:01 ` Eric Blake
2015-08-27 14:18 ` Jeff Cody
2015-08-27 14:19 ` Programmingkid
2015-08-27 14:01 ` Programmingkid
2015-08-27 18:59 ` John Snow
2015-08-27 19:20 ` Eric Blake
2015-08-27 13:33 ` Programmingkid
2015-08-27 13:49 ` Daniel P. Berrange
2015-08-27 13:56 ` Programmingkid
2015-08-27 14:02 ` Eric Blake
2015-08-27 14:34 ` Programmingkid
2015-08-27 14:42 ` Daniel P. Berrange
2015-08-27 15:20 ` Programmingkid
2015-08-27 15:40 ` Jeff Cody
2015-08-27 15:58 ` Programmingkid
2015-08-27 16:02 ` Daniel P. Berrange
2015-08-27 16:08 ` Programmingkid
2015-08-27 16:22 ` Daniel P. Berrange [this message]
2015-08-27 16:49 ` Programmingkid
2015-08-27 20:15 ` Programmingkid
2015-08-27 19:08 ` Jeff Cody
2015-08-27 19:27 ` Eric Blake
2015-08-27 20:37 ` Jeff Cody
2015-08-27 14:06 ` Daniel P. Berrange
2015-08-27 14:54 ` Programmingkid
2015-08-27 14:07 ` Jeff Cody
2015-08-27 15:13 ` Programmingkid
2015-08-27 15:19 ` Daniel P. Berrange
2015-08-27 15:22 ` Programmingkid
2015-08-27 15:55 ` Daniel P. Berrange
2015-08-27 16:03 ` Programmingkid
2015-08-27 16:06 ` Daniel P. Berrange
2015-08-27 16:08 ` Eric Blake
2015-09-01 12:34 ` Kevin Wolf
2015-09-01 14:18 ` Programmingkid
2015-09-01 14:43 ` Kevin Wolf
2015-09-01 15:55 ` Programmingkid
2015-09-03 14:34 ` Programmingkid
2015-09-03 14:43 ` Jeff Cody
2015-09-03 15:55 ` Programmingkid
2015-09-03 16:12 ` [Qemu-devel] [PATCH v3] qdev-monitor.c: Add device id generation Programmingkid
2015-08-26 17:28 ` [Qemu-devel] Should we auto-generate IDs? (was: [PATCH] qdev-monitor.c: Add device id generation) Daniel P. Berrange
2015-08-26 17:46 ` Programmingkid
2015-08-26 17:53 ` Daniel P. Berrange
2015-08-26 18:01 ` Programmingkid
2015-08-27 13:54 ` Daniel P. Berrange
2015-08-27 14:03 ` Programmingkid
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=20150827162219.GC24486@redhat.com \
--to=berrange@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).