From nobody Thu May 15 00:48:56 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 151066712718534.51812010610979;
Tue, 14 Nov 2017 05:45:27 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id DD57B356E4;
Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id B91178A9D6;
Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 825474A467;
Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjNk3001590 for ;
Tue, 14 Nov 2017 08:45:23 -0500
Received: by smtp.corp.redhat.com (Postfix)
id CD8058B567; Tue, 14 Nov 2017 13:45:23 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2C472D7680
for ; Tue, 14 Nov 2017 13:45:23 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:06 +0100
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 1/6] tests: add test cases for default sound output
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]);
Tue, 14 Nov 2017 13:45:26 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
These test cases models current situation where there is no way how
to specify sound output and that it's based on which graphic device
is the last one.
Signed-off-by: Pavel Hrdina
Reviewed-by: John Ferlan
---
.../qemuxml2argv-sound-default-output-sdl.args | 23 ++++++++++++++++++=
++
.../qemuxml2argv-sound-default-output-sdl.xml | 24 ++++++++++++++++++=
+++
...emuxml2argv-sound-default-output-spice-vnc.args | 25 ++++++++++++++++++=
++++
...qemuxml2argv-sound-default-output-spice-vnc.xml | 25 ++++++++++++++++++=
++++
.../qemuxml2argv-sound-default-output-spice.args | 24 ++++++++++++++++++=
+++
.../qemuxml2argv-sound-default-output-spice.xml | 24 ++++++++++++++++++=
+++
...emuxml2argv-sound-default-output-vnc-spice.args | 25 ++++++++++++++++++=
++++
...qemuxml2argv-sound-default-output-vnc-spice.xml | 25 ++++++++++++++++++=
++++
.../qemuxml2argv-sound-default-output-vnc.args | 24 ++++++++++++++++++=
+++
.../qemuxml2argv-sound-default-output-vnc.xml | 24 ++++++++++++++++++=
+++
tests/qemuxml2argvtest.c | 22 +++++++++++++++++++
11 files changed, 265 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-sdl.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-sdl.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-spice-vnc.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-spice-vnc.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-spice.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-spice.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-vnc-spice.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-vnc-spice.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-vnc.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-sound-default-outpu=
t-vnc.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.a=
rgs b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.args
new file mode 100644
index 0000000000..3e5982b9af
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.args
@@ -0,0 +1,23 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \
+-no-acpi \
+-boot c \
+-usb \
+-sdl \
+-vga cirrus \
+-device intel-hda,id=3Dsound0,bus=3Dpci.0,addr=3D0x3 \
+-device hda-duplex,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.x=
ml b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.xml
new file mode 100644
index 0000000000..37750ae924
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-sdl.xml
@@ -0,0 +1,24 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice=
-vnc.args b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice-=
vnc.args
new file mode 100644
index 0000000000..f5460887c4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice-vnc.ar=
gs
@@ -0,0 +1,25 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \
+-no-acpi \
+-boot c \
+-usb \
+-spice port=3D0 \
+-vnc 127.0.0.1:0 \
+-vga cirrus \
+-device intel-hda,id=3Dsound0,bus=3Dpci.0,addr=3D0x3 \
+-device hda-duplex,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice=
-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice-v=
nc.xml
new file mode 100644
index 0000000000..4e953162e1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice-vnc.xml
@@ -0,0 +1,25 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice=
.args b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice.args
new file mode 100644
index 0000000000..596d5d9412
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice.args
@@ -0,0 +1,24 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dspice \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \
+-no-acpi \
+-boot c \
+-usb \
+-spice port=3D0 \
+-vga cirrus \
+-device intel-hda,id=3Dsound0,bus=3Dpci.0,addr=3D0x3 \
+-device hda-duplex,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice=
.xml b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice.xml
new file mode 100644
index 0000000000..7f8c15307a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-spice.xml
@@ -0,0 +1,24 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-s=
pice.args b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-sp=
ice.args
new file mode 100644
index 0000000000..eebdeb081e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-spice.ar=
gs
@@ -0,0 +1,25 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dspice \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \
+-no-acpi \
+-boot c \
+-usb \
+-vnc 127.0.0.1:0 \
+-spice port=3D0 \
+-vga cirrus \
+-device intel-hda,id=3Dsound0,bus=3Dpci.0,addr=3D0x3 \
+-device hda-duplex,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-s=
pice.xml b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-spi=
ce.xml
new file mode 100644
index 0000000000..d6d2aa659e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc-spice.xml
@@ -0,0 +1,25 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.a=
rgs b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.args
new file mode 100644
index 0000000000..d3007a69c2
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.args
@@ -0,0 +1,24 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,\
+server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \
+-no-acpi \
+-boot c \
+-usb \
+-vnc 127.0.0.1:0 \
+-vga cirrus \
+-device intel-hda,id=3Dsound0,bus=3Dpci.0,addr=3D0x3 \
+-device hda-duplex,id=3Dsound0-codec0,bus=3Dsound0.0,cad=3D0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.x=
ml b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.xml
new file mode 100644
index 0000000000..c6733aaf2a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-default-output-vnc.xml
@@ -0,0 +1,24 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2e07b85aa6..6c80e0bc77 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1551,6 +1551,28 @@ mymain(void)
QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
QEMU_CAPS_OBJECT_USB_AUDIO);
+ DO_TEST("sound-default-output-spice",
+ QEMU_CAPS_HDA_DUPLEX,
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST("sound-default-output-vnc",
+ QEMU_CAPS_HDA_DUPLEX,
+ QEMU_CAPS_VNC,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST("sound-default-output-sdl",
+ QEMU_CAPS_HDA_DUPLEX,
+ QEMU_CAPS_SDL,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST("sound-default-output-spice-vnc",
+ QEMU_CAPS_HDA_DUPLEX,
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_VNC,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
+ DO_TEST("sound-default-output-vnc-spice",
+ QEMU_CAPS_HDA_DUPLEX,
+ QEMU_CAPS_SPICE,
+ QEMU_CAPS_VNC,
+ QEMU_CAPS_DEVICE_CIRRUS_VGA);
DO_TEST("fs9p",
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
QEMU_CAPS_FSDEV_WRITEOUT);
--=20
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Thu May 15 00:48:56 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1510667130649419.68358312871044;
Tue, 14 Nov 2017 05:45:30 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 6C45FC059721;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CB52A2920;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id E85B01800FC4;
Tue, 14 Nov 2017 13:45:28 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjOsg001600 for ;
Tue, 14 Nov 2017 08:45:24 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 9E8CDD767E; Tue, 14 Nov 2017 13:45:24 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id 25D1D8B56F
for ; Tue, 14 Nov 2017 13:45:23 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:07 +0100
Message-Id:
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 2/6] qemu: move QEMU_AUDIO_DRIVER out of graphic
into sound
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]);
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
Setting the default audio output depends on specific graphic device
but requires having sound device configured as well and it's the sound
device that handles the audio.
Signed-off-by: Pavel Hrdina
Reviewed-by: John Ferlan
---
src/qemu/qemu_command.c | 84 +++++++++++++++---=
----
.../qemuxml2argv-clock-france.args | 2 +-
2 files changed, 58 insertions(+), 28 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eb72db33ba..e1ef1b05fa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4442,10 +4442,62 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound,
}
=20
=20
+static void
+qemuBuildSoundAudioEnv(virCommandPtr cmd,
+ const virDomainDef *def,
+ virQEMUDriverConfigPtr cfg)
+{
+ if (def->ngraphics =3D=3D 0) {
+ if (cfg->nogfxAllowHostAudio)
+ virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
+ else
+ virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
+ } else {
+ switch (def->graphics[def->ngraphics - 1]->type) {
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ /* If using SDL for video, then we should just let it
+ * use QEMU's host audio drivers, possibly SDL too
+ * User can set these two before starting libvirtd
+ */
+ virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
+ virCommandAddEnvPassBlockSUID(cmd, "SDL_AUDIODRIVER", NULL);
+
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
+ /* Unless user requested it, set the audio backend to none, to
+ * prevent it opening the host OS audio devices, since that ca=
uses
+ * security issues and might not work when using VNC.
+ */
+ if (cfg->vncAllowHostAudio)
+ virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
+ else
+ virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
+
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ /* SPICE includes native support for tunnelling audio, so we
+ * set the audio backend to point at SPICE's own driver
+ */
+ virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dspice");
+
+ break;
+
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ break;
+ }
+ }
+}
+
+
static int
qemuBuildSoundCommandLine(virCommandPtr cmd,
const virDomainDef *def,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ virQEMUDriverConfigPtr cfg)
{
size_t i, j;
=20
@@ -4498,6 +4550,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd,
}
}
}
+
+ qemuBuildSoundAudioEnv(cmd, def, cfg);
+
return 0;
}
=20
@@ -7951,15 +8006,6 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigP=
tr cfg,
if (graphics->data.vnc.keymap)
virCommandAddArgList(cmd, "-k", graphics->data.vnc.keymap, NULL);
=20
- /* Unless user requested it, set the audio backend to none, to
- * prevent it opening the host OS audio devices, since that causes
- * security issues and might not work when using VNC.
- */
- if (cfg->vncAllowHostAudio)
- virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
- else
- virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
-
return 0;
=20
error:
@@ -8201,10 +8247,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfi=
gPtr cfg,
if (graphics->data.spice.keymap)
virCommandAddArgList(cmd, "-k",
graphics->data.spice.keymap, NULL);
- /* SPICE includes native support for tunnelling audio, so we
- * set the audio backend to point at SPICE's own driver
- */
- virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dspice");
=20
return 0;
=20
@@ -8235,13 +8277,6 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr =
cfg,
if (graphics->data.sdl.fullscreen)
virCommandAddArg(cmd, "-full-screen");
=20
- /* If using SDL for video, then we should just let it
- * use QEMU's host audio drivers, possibly SDL too
- * User can set these two before starting libvirtd
- */
- virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
- virCommandAddEnvPassBlockSUID(cmd, "SDL_AUDIODRIVER", NULL);
-
/* New QEMU has this flag to let us explicitly ask for
* SDL graphics. This is better than relying on the
* default, since the default changes :-( */
@@ -9995,11 +10030,6 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
} else {
virCommandAddArg(cmd, "-nographic");
}
-
- if (cfg->nogfxAllowHostAudio)
- virCommandAddEnvPassBlockSUID(cmd, "QEMU_AUDIO_DRV", NULL);
- else
- virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
}
=20
/* Disable global config files and default devices */
@@ -10083,7 +10113,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildVideoCommandLine(cmd, def, qemuCaps) < 0)
goto error;
=20
- if (qemuBuildSoundCommandLine(cmd, def, qemuCaps) < 0)
+ if (qemuBuildSoundCommandLine(cmd, def, qemuCaps, cfg) < 0)
goto error;
=20
if (qemuBuildWatchdogCommandLine(cmd, def, qemuCaps) < 0)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-clock-france.args b/tests/=
qemuxml2argvdata/qemuxml2argv-clock-france.args
index 9bde6d967b..2701179273 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-clock-france.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-clock-france.args
@@ -3,8 +3,8 @@ PATH=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dnone \
TZ=3DEurope/Paris \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
--=20
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Thu May 15 00:48:56 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1510667129616222.69195251684607;
Tue, 14 Nov 2017 05:45:29 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id EBBE75D9F6;
Tue, 14 Nov 2017 13:45:27 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id C409BA2483;
Tue, 14 Nov 2017 13:45:27 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 87E481800BDE;
Tue, 14 Nov 2017 13:45:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjPwQ001605 for ;
Tue, 14 Nov 2017 08:45:25 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 70CF48B56F; Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id EC155D7682
for ; Tue, 14 Nov 2017 13:45:24 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:08 +0100
Message-Id:
<725dc065872d7d8577569c3dc9595a541170aaa8.1510667009.git.phrdina@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 3/6] qemu: explicitly disable audio if there is no
sound device
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]);
Tue, 14 Nov 2017 13:45:28 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
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 =3D=3D 0) {
+ virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=3Dnone");
+ return;
+ }
+
if (def->ngraphics =3D=3D 0) {
if (cfg->nogfxAllowHostAudio)
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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args b/te=
sts/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.ar=
gs 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=3Dtest \
LOGNAME=3Dtest \
XAUTHORITY=3D/root/.Xauthority \
DISPLAY=3D:0.1 \
+QEMU_AUDIO_DRV=3Dnone \
/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=3Dtest \
LOGNAME=3Dtest \
XAUTHORITY=3D/root/.Xauthority \
DISPLAY=3D:0.1 \
+QEMU_AUDIO_DRV=3Dnone \
/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-x=
fer.args
index 9492458831..433b5c5b68 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.ar=
gs
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agent-file-xfer.ar=
gs
@@ -3,7 +3,7 @@ PATH=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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.ar=
gs
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.ar=
gs
@@ -3,7 +3,7 @@ PATH=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-no-args.arg=
s 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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.arg=
s 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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
SASL_CONF_PATH=3D/root/.sasl2 \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.a=
rgs 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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/test=
s/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args b/tests/q=
emuxml2argvdata/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name guest=3Dfoo=3D1,,bar=3D2,debug-threads=3Don \
-S \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-spiceport.args b/te=
sts/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/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=3D/bin \
HOME=3D/home/test \
USER=3Dtest \
LOGNAME=3Dtest \
-QEMU_AUDIO_DRV=3Dspice \
+QEMU_AUDIO_DRV=3Dnone \
/usr/bin/qemu-system-i686 \
-name QEMUGuest1 \
-S \
--=20
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Thu May 15 00:48:56 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 15106671308251001.2996258168886;
Tue, 14 Nov 2017 05:45:30 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 42F386A7EE;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BEF8183D5;
Tue, 14 Nov 2017 13:45:29 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id C85C41800C87;
Tue, 14 Nov 2017 13:45:28 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjQRw001618 for ;
Tue, 14 Nov 2017 08:45:26 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 437118B56F; Tue, 14 Nov 2017 13:45:26 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id BEF93D767E
for ; Tue, 14 Nov 2017 13:45:25 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:09 +0100
Message-Id:
<774c33a21122436dd813584ed3f727b115e4aa68.1510667009.git.phrdina@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 4/6] conf: introduce
=20
+
+ Since 3.10.0 sound device can have
+ an optional output element which configures where
+ the audio output is connected within host. There is mandatory
+ type attribute where valid values are 'none' to
+ disable the audio output, 'spice', 'pa', 'sdl', 'alsa', 'oss'.
+ This might not be supported by all hypervisors.
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9cec1a0637..c499229c43 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3803,6 +3803,20 @@
+
+
+
+
+ none
+ spice
+ pa
+ sdl
+ alsa
+ oss
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fffcc8e9da..33e59c7667 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -517,6 +517,15 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MO=
DEL_LAST,
"ich9",
"usb")
=20
+VIR_ENUM_IMPL(virDomainSoundOutput, VIR_DOMAIN_SOUND_OUTPUT_TYPE_LAST,
+ "default",
+ "none",
+ "spice",
+ "pa",
+ "sdl",
+ "alsa",
+ "oss")
+
VIR_ENUM_IMPL(virDomainKeyWrapCipherName,
VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_LAST,
"aes",
@@ -13687,6 +13696,50 @@ virDomainSoundCodecDefParseXML(xmlNodePtr node)
}
=20
=20
+static int
+virDomainSoundOutputParseXML(xmlXPathContextPtr ctxt,
+ virDomainSoundDefPtr sound)
+{
+ int ret =3D -1;
+ char *type =3D NULL;
+ int typeVal;
+ xmlNodePtr *outputNodes =3D NULL;
+ int noutputs;
+
+ noutputs =3D virXPathNodeSet("./output", ctxt, &outputNodes);
+ if (noutputs < 0)
+ return -1;
+
+ if (noutputs > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sound device can have only one output configured=
"));
+ goto cleanup;
+ }
+
+ if (noutputs > 0) {
+ if (!(type =3D virXMLPropString(outputNodes[0], "type"))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("sound output type must be specified"));
+ goto cleanup;
+ }
+
+ if ((typeVal =3D virDomainSoundOutputTypeFromString(type)) < 0) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid sound output type '%s'"), type);
+ goto cleanup;
+ }
+
+ sound->output =3D typeVal;
+ }
+
+ ret =3D 0;
+ cleanup:
+ VIR_FREE(outputNodes);
+ VIR_FREE(type);
+ return ret;
+}
+
+
static virDomainSoundDefPtr
virDomainSoundDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
@@ -13741,6 +13794,9 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xml=
opt,
}
}
=20
+ if (virDomainSoundOutputParseXML(ctxt, def) < 0)
+ goto error;
+
if (virDomainDeviceInfoParseXML(xmlopt, node, NULL, &def->info, flags)=
< 0)
goto error;
=20
@@ -24111,6 +24167,11 @@ virDomainSoundDefFormat(virBufferPtr buf,
=20
virDomainDeviceInfoFormat(&childBuf, &def->info, flags);
=20
+ if (def->output !=3D VIR_DOMAIN_SOUND_OUTPUT_TYPE_DEFAULT) {
+ virBufferAsprintf(&childBuf, "\n",
+ virDomainSoundOutputTypeToString(def->output));
+ }
+
if (virBufferCheckError(&childBuf) < 0)
return -1;
=20
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e3f060b122..55a984c781 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1332,12 +1332,25 @@ struct _virDomainSoundCodecDef {
int cad;
};
=20
+typedef enum {
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_DEFAULT,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_NONE,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_SPICE,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_PA,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_SDL,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_ALSA,
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_OSS,
+
+ VIR_DOMAIN_SOUND_OUTPUT_TYPE_LAST
+} virDomainSoundOutputType;
+
struct _virDomainSoundDef {
int model;
virDomainDeviceInfo info;
=20
size_t ncodecs;
virDomainSoundCodecDefPtr *codecs;
+ virDomainSoundOutputType output;
};
=20
typedef enum {
@@ -3246,6 +3259,7 @@ VIR_ENUM_DECL(virDomainChrTcpProtocol)
VIR_ENUM_DECL(virDomainChrSpicevmc)
VIR_ENUM_DECL(virDomainSoundCodec)
VIR_ENUM_DECL(virDomainSoundModel)
+VIR_ENUM_DECL(virDomainSoundOutput)
VIR_ENUM_DECL(virDomainKeyWrapCipherName)
VIR_ENUM_DECL(virDomainMemballoonModel)
VIR_ENUM_DECL(virDomainSmbiosMode)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5a4d50471d..0ef7e896d8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -516,6 +516,8 @@ virDomainSmbiosModeTypeToString;
virDomainSoundDefFree;
virDomainSoundModelTypeFromString;
virDomainSoundModelTypeToString;
+virDomainSoundOutputTypeFromString;
+virDomainSoundOutputTypeToString;
virDomainStartupPolicyTypeFromString;
virDomainStartupPolicyTypeToString;
virDomainStateReasonFromString;
--=20
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Thu May 15 00:48:56 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 151066713451910.579520521735276;
Tue, 14 Nov 2017 05:45:34 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 46AEE10F28;
Tue, 14 Nov 2017 13:45:32 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 21A568A9E8;
Tue, 14 Nov 2017 13:45:32 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id DB9293FCFC;
Tue, 14 Nov 2017 13:45:31 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id vAEDjR8v001625 for ;
Tue, 14 Nov 2017 08:45:27 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 35C568B559; Tue, 14 Nov 2017 13:45:27 +0000 (UTC)
Received: from antique-work.brq.redhat.com (unknown [10.43.2.152])
by smtp.corp.redhat.com (Postfix) with ESMTP id B07FAD768B
for ; Tue, 14 Nov 2017 13:45:26 +0000 (UTC)
From: Pavel Hrdina
To: libvir-list@redhat.com
Date: Tue, 14 Nov 2017 14:45:10 +0100
Message-Id:
<7766efd1277955de3102fd91937016f4adf0beec.1510667009.git.phrdina@redhat.com>
In-Reply-To:
References:
In-Reply-To:
References:
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 5/6] qemu: implement element for
devices
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Tue, 14 Nov 2017 13:45:32 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
Content-Type: text/plain; charset="utf-8"
So far we were configuring the sound output based on what graphic device
was configured in domain XML. This had a several disadvantages, it's
not transparent, in case of multiple graphic devices it was overwritten
by the last one and there was no simple way how to configure this per
domain.
The new element for devices allows you to configure
which output will be used for each domain, however QEMU has a limitation
that all sound devices will always use the same output because it is
configured by environment variable QEMU_AUDIO_DRV per domain.
For backward compatibility we need to preserve the defaults if no output
is specified:
- for vnc graphic it's by default NONE unless "vnc_allow_host_audio"
was enabled, in that case we use DEFAULT which means it will pass
the environment variable visible by libvirtd
- for sdl graphic by default we pass the environment variable
- for spice graphic we configure the SPICE output
- if no graphic is configured we use by default NONE unless
"nogfx_allow_host_audio" was enabled, in that case we pass
the environment variable
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1375433
Signed-off-by: Pavel Hrdina
---
docs/formatdomain.html.in | 4 ++-
src/qemu/qemu_command.c | 84 +++++++++++++++++++++----------------------=
----
src/qemu/qemu_domain.c | 54 ++++++++++++++++++++++++++++++
src/qemu/qemu_process.c | 41 +++++++++++++++++++++++
4 files changed, 135 insertions(+), 48 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 3b7c367fc7..ae0d8b86be 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7064,7 +7064,9 @@ qemu-kvm -net nic,model=3D? /dev/null
the audio output is connected within host. There is mandatory
type attribute where valid values are 'none' to
disable the audio output, 'spice', 'pa', 'sdl', 'alsa', 'oss'.
- This might not be supported by all hypervisors.
+ This might not be supported by all hypervisors. QEMU driver
+ has a limitation that all sound devices have to use the same
+ output.