[libvirt] [PATCH alt] conf: Allow user define their own alias

Daniel P. Berrange berrange at redhat.com
Tue Oct 3 14:19:02 UTC 2017

On Fri, Sep 29, 2017 at 09:06:01AM +0200, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1434451
> It comes handy for management application to be able to have a
> per-device label so that it can uniquely identify devices it
> cares about. The advantage of this approach is that we don't have
> to generate aliases at define time (non trivial amount of work
> and problems). The only thing we do is parse the user supplied
> tag and format it back. For instance:
>     <disk type='block' device='disk'>
>       <driver name='qemu' type='raw'/>
>       <source dev='/dev/HostVG/QEMUGuest1'/>
>       <target dev='hda' bus='ide'/>
>       <alias user='myDisk0'/>
>       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>     </disk>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> An alternative approach to:
> https://www.redhat.com/archives/libvir-list/2017-September/msg00765.html
> Honestly, I prefer this one as it's simpler and we don't have to care about
> devices changing their aliases on cold plug. I mean, on cold (un-)plug we'd
> have to regenerate the aliases so it might be hard to track certain device.
> But with this approach, it's no problem.

Can you elaborate on you mean by the cold plug problem here ?

Are you saying that if you cold plug a single device, we would regenerate
aliases on every single other device too ?  I would surely think we can
avoid that kind of thing.

To make hotplug easier for applications we could add a V2 hotplug API
which *returns* the fully-expanded device XML.

That way applications would immediately learn the alias of the newly
hotplugged device in a simple manner.

While we were at it, this would give us opportunity to make the v2
hotplug API support hotplugging of multiple devices at once. This is
a feature we've needed for PCI assignment where some devices have to
be co-assigned at the same time.

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

More information about the libvir-list mailing list