[libvirt] [PATCH 3/6] qemu: explicitly disable audio if there is no sound device

Pavel Hrdina phrdina at redhat.com
Tue Nov 21 11:15:13 UTC 2017


On Mon, Nov 20, 2017 at 05:55:10PM -0500, John Ferlan wrote:
> 
> 
> On 11/14/2017 08:45 AM, Pavel Hrdina wrote:
> > If there is no sound device configured for the guest we can disable the
> > audio output because hot-plugging sound devices isn't supported.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/qemu/qemu_command.c                                              | 5 +++++
> >  tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args        | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args            | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args     | 1 +
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args                | 1 +
> >  .../qemuxml2argv-graphics-spice-agent-file-xfer.args                 | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args   | 2 +-
> >  .../qemuxml2argv-graphics-spice-auto-socket-cfg.args                 | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args  | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args  | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.args      | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args      | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args         | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args       | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args    | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args              | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-name-escape.args                 | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args            | 2 +-
> >  tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args   | 2 +-
> >  19 files changed, 23 insertions(+), 16 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index e1ef1b05fa..c5c7bd7e54 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -4447,6 +4447,11 @@ qemuBuildSoundAudioEnv(virCommandPtr cmd,
> >                         const virDomainDef *def,
> >                         virQEMUDriverConfigPtr cfg)
> >  {
> > +    if (def->nsounds == 0) {
> > +        virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none");
> > +        return;
> > +    }
> > +
> 
> But based on the changes to the .args file for Spice - wouldn't the
> default be whatever Spice had? Now we're requiring someone to configure
> the sound for Spice?
> 
> What about a migration... On hostA with 3.9.0 - we have sound... We
> migrate to hostB with these patches and the sound goes away?
> 
> 
> >      if (def->ngraphics == 0) {
> >          if (cfg->nogfxAllowHostAudio)
> 
> Also if there was no graphics and no sound device previously, the domain
> would be started with whatever QEMU_AUDIO_DRV was set to (outside
> libvirt context), with this path, right?  So in this case, we then also
> would "lose" the sound - I think that'd be the text console case.
> 
> Maybe I just need to be convince more on this one.  Always "of concern"
> to remove some default just in case "someone" has assumed that [and I
> haven't looked ahead yet, so my opinion could change again ;-)]

If there is no sound device you have no audio even if you have graphic
device configured.  It's the same as in real world, if you don't have
sound card you don't have audio output.  So there is no issue with
migration because there was no audio output on hostA.

This is what is wrong with the current implementation, the audio output
is based on graphic device but there is no connection to sound device.
The only connection is that you can configure SPICE audio output
and the audio will be send to client via SPICE protocol.

So no matter what the QEMU_AUDIO_DRV is set to, if there is no sound
device there is no audio.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171121/b6bad64f/attachment-0001.sig>


More information about the libvir-list mailing list