[PATCH v2 2/4] conf: allow to map sound device to host device

Daniel P. Berrangé berrange at redhat.com
Fri Jul 31 09:42:41 UTC 2020

On Tue, Jul 28, 2020 at 06:58:41PM +0400, Roman Bogorodskiy wrote:
> Introduce a new device element "<audio>" which allows
> to map guest sound device specified using the "<sound>"
> element to specific audio backend.
> Example:
>   <sound model='ich6'>
>      <audio id='audio0'/>
>   </sound>
>   <audio id='audio' type='oss'>
>      <input dev='/dev/dsp0'/>
>      <output dev='/dev/dsp0'/>
>   </audio>

Thinking again about this design, I wonder if we should simplify a
little by using an integer index value instead of string ID ?

   <sound model='ich6' audio='1'/>
   <audio index='1' type='oss'>
      <input dev='/dev/dsp0'/>
      <output dev='/dev/dsp0'/>

my original suggestion of an ID string was biased from my view of
QEMU's underlying impl that uses string IDs, but the string ID is
not really useful to other hypervisors, and even in QEMU an integer
index is sufficient at libvirt level, as we can deterministically
turn it into a ID string.

The use of an integer index is more aligned with what we do for
<controllers> for example.  I'm also considering that if we add
support for multi-seat we might just use an integer ID there to
enumerate seat numbers.

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