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(a)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 ;-)]
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
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.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-spice-agent-file-xfer.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args
index 9492458831..433b5c5b68 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.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-spice-agentmouse.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
index a45ab2205c..7d40c10fcd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.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-spice-auto-socket-cfg.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args
index b0c16077d6..9dfb3c6843 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.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-spice-auto-socket.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args
index b0c16077d6..9dfb3c6843 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.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-spice-compression.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
index 07a1d12bda..c7dc9e4b8a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.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-spice-no-args.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.args
index e7b402169f..50ac953368 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.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-spice-qxl-vga.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
index f6c25af18a..0d88091675 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.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-spice-sasl.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args
index 6198510aa0..e3483e9a71 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args
@@ -4,7 +4,7 @@ HOME=/home/test \
USER=test \
LOGNAME=test \
SASL_CONF_PATH=/root/.sasl2 \
-QEMU_AUDIO_DRV=spice \
+QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args
index 34a4dced0a..d3a4774cb9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.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-spice-usb-redir.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
index 8deaee335f..49cc42b792 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.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-spice.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index d5d1869645..2cb76e929e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.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-name-escape.args
b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
index d94ab76312..9e631ee5ec 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.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 guest=foo=1,,bar=2,debug-threads=on \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args
b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args
index a3981499a2..93d758864e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.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-video-virtio-gpu-spice-gl.args
b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args
index 9c6ba79578..04327951f6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-spice-gl.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 \