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

2017-11-21 Thread Daniel P. Berrange
On Tue, Nov 21, 2017 at 01:21:26PM +0100, Pavel Hrdina wrote:
> On Tue, Nov 21, 2017 at 12:09:54PM +, Daniel P. Berrange wrote:
> > On Tue, Nov 21, 2017 at 01:02:05PM +0100, Peter Krempa wrote:
> > > On Tue, Nov 21, 2017 at 11:48:20 +, Daniel Berrange wrote:
> > > > On Tue, Nov 21, 2017 at 12:44:44PM +0100, Peter Krempa wrote:
> > > > > On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> > > > > > IOW, I don't think this patch is desirable.
> > > > > 
> > > > > We could allow hotplug only if qemu will allow to specify the sound
> > > > > output per-soundcard which would avoid this problem.
> > > > 
> > > > I agree that having ability to configure distinct outputs per sound card
> > > > might be useful, I don't think it is a blocking feature for hotplugging
> > > > sound cards. ie, there's no reason why a user should not be able to
> > > > unplug their current sound card, and plug in a new sound card for a
> > > > running guests - they would only ever have 1 sound card present at
> > > > a time in that scenario, so distinct outputs is not a requirement
> > > > for that usecase.
> > > 
> > > While not a requirement, mandating that new features are available only
> > > with new software sometimes saves a lot of headaches. I would not
> > > mind if sound device hotplug will be supported only when specific
> > > outputs can be selected when adding the sound card and would not work
> > > without that.
> > > 
> > > Unfortunately qemu does not yet support this and I don't think that they
> > > will any soon.
> > 
> > Agreed, and the most interesting thing for multiple audio cards is
> > probably multi-seat support, which wouldn't need choosing between
> > different backends, instead choosing different spice/vnc instances.
> > 
> > Basically, I think this patch should be dropped.
> 
> Ok, I don't mind dropping this patch.  At least it pointed out that
> QEMU is design is broken.  This patch only affects use case where
> the domain is started without any sound device and I personally don't
> care if the audio output will be basically random unless you have
> spice graphic configured.
> 
> However, if we enabled hot-plugging sound device we need to make sure
> that we don't allow configuring sound output until we have a decent way
> how to configure it.

Agreed - that's pretty much why i never exposed sound backend in the XML
and instead hardcoded it with optional override in qemu.conf when first
doing this

Regards,
Daniel
-- 
|: 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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-11-21 Thread Pavel Hrdina
On Tue, Nov 21, 2017 at 12:09:54PM +, Daniel P. Berrange wrote:
> On Tue, Nov 21, 2017 at 01:02:05PM +0100, Peter Krempa wrote:
> > On Tue, Nov 21, 2017 at 11:48:20 +, Daniel Berrange wrote:
> > > On Tue, Nov 21, 2017 at 12:44:44PM +0100, Peter Krempa wrote:
> > > > On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> > > > > IOW, I don't think this patch is desirable.
> > > > 
> > > > We could allow hotplug only if qemu will allow to specify the sound
> > > > output per-soundcard which would avoid this problem.
> > > 
> > > I agree that having ability to configure distinct outputs per sound card
> > > might be useful, I don't think it is a blocking feature for hotplugging
> > > sound cards. ie, there's no reason why a user should not be able to
> > > unplug their current sound card, and plug in a new sound card for a
> > > running guests - they would only ever have 1 sound card present at
> > > a time in that scenario, so distinct outputs is not a requirement
> > > for that usecase.
> > 
> > While not a requirement, mandating that new features are available only
> > with new software sometimes saves a lot of headaches. I would not
> > mind if sound device hotplug will be supported only when specific
> > outputs can be selected when adding the sound card and would not work
> > without that.
> > 
> > Unfortunately qemu does not yet support this and I don't think that they
> > will any soon.
> 
> Agreed, and the most interesting thing for multiple audio cards is
> probably multi-seat support, which wouldn't need choosing between
> different backends, instead choosing different spice/vnc instances.
> 
> Basically, I think this patch should be dropped.

Ok, I don't mind dropping this patch.  At least it pointed out that
QEMU is design is broken.  This patch only affects use case where
the domain is started without any sound device and I personally don't
care if the audio output will be basically random unless you have
spice graphic configured.

However, if we enabled hot-plugging sound device we need to make sure
that we don't allow configuring sound output until we have a decent way
how to configure it.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-11-21 Thread Daniel P. Berrange
On Tue, Nov 21, 2017 at 01:02:05PM +0100, Peter Krempa wrote:
> On Tue, Nov 21, 2017 at 11:48:20 +, Daniel Berrange wrote:
> > On Tue, Nov 21, 2017 at 12:44:44PM +0100, Peter Krempa wrote:
> > > On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> > > > IOW, I don't think this patch is desirable.
> > > 
> > > We could allow hotplug only if qemu will allow to specify the sound
> > > output per-soundcard which would avoid this problem.
> > 
> > I agree that having ability to configure distinct outputs per sound card
> > might be useful, I don't think it is a blocking feature for hotplugging
> > sound cards. ie, there's no reason why a user should not be able to
> > unplug their current sound card, and plug in a new sound card for a
> > running guests - they would only ever have 1 sound card present at
> > a time in that scenario, so distinct outputs is not a requirement
> > for that usecase.
> 
> While not a requirement, mandating that new features are available only
> with new software sometimes saves a lot of headaches. I would not
> mind if sound device hotplug will be supported only when specific
> outputs can be selected when adding the sound card and would not work
> without that.
> 
> Unfortunately qemu does not yet support this and I don't think that they
> will any soon.

Agreed, and the most interesting thing for multiple audio cards is
probably multi-seat support, which wouldn't need choosing between
different backends, instead choosing different spice/vnc instances.

Basically, I think this patch should be dropped.

Regards,
Daniel
-- 
|: 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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-11-21 Thread Daniel P. Berrange
On Tue, Nov 21, 2017 at 12:57:36PM +0100, Pavel Hrdina wrote:
> On Tue, Nov 21, 2017 at 11:24:06AM +, Daniel P. Berrange wrote:
> > On Tue, Nov 14, 2017 at 02:45:08PM +0100, 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.
> > 
> > Are you sure about that. While libvirt may not have wired up ability to
> > hotplug sound devices, I'm pretty sure that QEMU is able to hotplug
> > them.
> > 
> > Ff libvirt forceably disables the audio backend, now, and then future
> > libvirt enables the pre-existing QEMU support for hotplug, existing VMs
> > will be doomed.
> > 
> > IOW, I don't think this patch is desirable.
> 
> Right, I meant from libvirt POV.  Anyway, if we allow to hot-plug sound
> device, you have no control where the audio output will be connected.
> Configuration of audio output is really stupid in QEMU.  You need to use
> environment variable, you have only one so you cannot configure
> different sound devices to have different audio output and from
> documentation it is not clear what is the default if you don't set the
> QEMU_AUDIO_DRV.  Checking the code gives you headache :).
> 
> The default audio output depends on what audio drivers are enabled and
> compiled in QEMU and on the order of the audio drivers, these can be
> used as default: alsa, dsound, core, none, oss, pa, sdl, spice
> (if there is spice graphics).
> 
> So based on all of the findings, if we allow hot-plugging sound device
> and the QEMU_AUDIO_DRV is not configured in advance there is no way how
> you can configure the audio output and no way how we can tell which one
> will be the default.
> 
> I would rather have this limitation that you should start the domain
> with sound device configured instead of allowing hot-plug since the
> audio output design in QEMU is foobar.

As mentioned in my reply to Peter, I don't think ability to configure
the sound output is a blocker for hotplug, as there's valid reasons
for hotplug whih don't involve multiple cards being present at once.

Also 95+% of users of libvirt will have SPICE enabled, so all audio will
get routed via SPICE regardless.  So what would be most interesting there
is not the ability to pick output backend, but the ability to pick which
spice server instance is used. This is a more general task of wiring up
multi-seat support that QEMU has had for a while, but libvirt doesn't yet
support.

Regards,
Daniel
-- 
|: 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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-11-21 Thread Peter Krempa
On Tue, Nov 21, 2017 at 11:48:20 +, Daniel Berrange wrote:
> On Tue, Nov 21, 2017 at 12:44:44PM +0100, Peter Krempa wrote:
> > On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> > > IOW, I don't think this patch is desirable.
> > 
> > We could allow hotplug only if qemu will allow to specify the sound
> > output per-soundcard which would avoid this problem.
> 
> I agree that having ability to configure distinct outputs per sound card
> might be useful, I don't think it is a blocking feature for hotplugging
> sound cards. ie, there's no reason why a user should not be able to
> unplug their current sound card, and plug in a new sound card for a
> running guests - they would only ever have 1 sound card present at
> a time in that scenario, so distinct outputs is not a requirement
> for that usecase.

While not a requirement, mandating that new features are available only
with new software sometimes saves a lot of headaches. I would not
mind if sound device hotplug will be supported only when specific
outputs can be selected when adding the sound card and would not work
without that.

Unfortunately qemu does not yet support this and I don't think that they
will any soon.

Also code for outputting to pulseaudio does not get much love. I had to
fix it so that the virtual sound mixer does not mess with physical
michrophone volume setting in the host. And it was broken for years.

I agree that this patch could bite us though, given that I don't see
qemu fixing the sound backends soon as they did not do it until now.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-11-21 Thread Pavel Hrdina
On Tue, Nov 21, 2017 at 11:24:06AM +, Daniel P. Berrange wrote:
> On Tue, Nov 14, 2017 at 02:45:08PM +0100, 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.
> 
> Are you sure about that. While libvirt may not have wired up ability to
> hotplug sound devices, I'm pretty sure that QEMU is able to hotplug
> them.
> 
> Ff libvirt forceably disables the audio backend, now, and then future
> libvirt enables the pre-existing QEMU support for hotplug, existing VMs
> will be doomed.
> 
> IOW, I don't think this patch is desirable.

Right, I meant from libvirt POV.  Anyway, if we allow to hot-plug sound
device, you have no control where the audio output will be connected.
Configuration of audio output is really stupid in QEMU.  You need to use
environment variable, you have only one so you cannot configure
different sound devices to have different audio output and from
documentation it is not clear what is the default if you don't set the
QEMU_AUDIO_DRV.  Checking the code gives you headache :).

The default audio output depends on what audio drivers are enabled and
compiled in QEMU and on the order of the audio drivers, these can be
used as default: alsa, dsound, core, none, oss, pa, sdl, spice
(if there is spice graphics).

So based on all of the findings, if we allow hot-plugging sound device
and the QEMU_AUDIO_DRV is not configured in advance there is no way how
you can configure the audio output and no way how we can tell which one
will be the default.

I would rather have this limitation that you should start the domain
with sound device configured instead of allowing hot-plug since the
audio output design in QEMU is foobar.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-11-21 Thread Daniel P. Berrange
On Tue, Nov 21, 2017 at 12:44:44PM +0100, Peter Krempa wrote:
> On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> > On Tue, Nov 14, 2017 at 02:45:08PM +0100, 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.
> > 
> > Are you sure about that. While libvirt may not have wired up ability to
> > hotplug sound devices, I'm pretty sure that QEMU is able to hotplug
> > them.
> 
> At least the USB sound card should allow hotplug in qemu, so I agree
> with this...
> 
> On the other hand the output should be a property which can be
> configured individually for every sound card. I think it's desirable to
> have a soundcard dedicated to one output method and a second one for a
> different output method and let the guest OS decide on which cards the
> sound will play.
> 
> > Ff libvirt forceably disables the audio backend, now, and then future
> > libvirt enables the pre-existing QEMU support for hotplug, existing VMs
> > will be doomed.
> > 
> > IOW, I don't think this patch is desirable.
> 
> We could allow hotplug only if qemu will allow to specify the sound
> output per-soundcard which would avoid this problem.

I agree that having ability to configure distinct outputs per sound card
might be useful, I don't think it is a blocking feature for hotplugging
sound cards. ie, there's no reason why a user should not be able to
unplug their current sound card, and plug in a new sound card for a
running guests - they would only ever have 1 sound card present at
a time in that scenario, so distinct outputs is not a requirement
for that usecase.

Regards,
Daniel
-- 
|: 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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-11-21 Thread Peter Krempa
On Tue, Nov 21, 2017 at 11:24:06 +, Daniel Berrange wrote:
> On Tue, Nov 14, 2017 at 02:45:08PM +0100, 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.
> 
> Are you sure about that. While libvirt may not have wired up ability to
> hotplug sound devices, I'm pretty sure that QEMU is able to hotplug
> them.

At least the USB sound card should allow hotplug in qemu, so I agree
with this...

On the other hand the output should be a property which can be
configured individually for every sound card. I think it's desirable to
have a soundcard dedicated to one output method and a second one for a
different output method and let the guest OS decide on which cards the
sound will play.

> Ff libvirt forceably disables the audio backend, now, and then future
> libvirt enables the pre-existing QEMU support for hotplug, existing VMs
> will be doomed.
> 
> IOW, I don't think this patch is desirable.

We could allow hotplug only if qemu will allow to specify the sound
output per-soundcard which would avoid this problem.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-11-21 Thread Daniel P. Berrange
On Tue, Nov 14, 2017 at 02:45:08PM +0100, 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.

Are you sure about that. While libvirt may not have wired up ability to
hotplug sound devices, I'm pretty sure that QEMU is able to hotplug
them.

Ff libvirt forceably disables the audio backend, now, and then future
libvirt enables the pre-existing QEMU support for hotplug, existing VMs
will be doomed.

IOW, I don't think this patch is desirable.


Regards,
Daniel
-- 
|: 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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2017-11-21 Thread Pavel Hrdina
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 
> > ---
> >  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


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2017-11-20 Thread John Ferlan


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 
> ---
>  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 ;-)]

John

>  virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args 
> b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args
> index 19f7e11d22..dae3636f6b 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args
> @@ -3,7 +3,7 @@ PATH=/bin \
>  HOME=/home/test \
>  USER=test \
>  LOGNAME=test \
> -QEMU_AUDIO_DRV=spice \
> +QEMU_AUDIO_DRV=none \
>  /usr/bin/qemu-system-i686 \
>  -name QEMUGuest1 \
>  -S \
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args 
> b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
> index fa9f4c5279..1f49107632 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
> @@ -3,7 +3,7 @@ PATH=/bin \
>  HOME=/home/test \
>  USER=test \
>  LOGNAME=test \
> -QEMU_AUDIO_DRV=spice \
> +QEMU_AUDIO_DRV=none \
>  /usr/bin/qemu-system-i686 \
>  -name QEMUGuest1 \
>  -S \
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args 
> b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
> index cc833970cc..ec858ddcb0 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
> @@ -5,6 +5,7 @@ USER=test \
>  LOGNAME=test \
>  XAUTHORITY=/root/.Xauthority \
>  DISPLAY=:0.1 \
> +QEMU_AUDIO_DRV=none \
>  /usr/bin/qemu-system-i686 \
>  -name QEMUGuest1 \
>  -S \
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args 
> b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
> index b9492e83f4..3f7631dc07 100644
> --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args
> +++