[pve-devel] [PATCH v2 qemu-server] cfg2cmd: Add the audiodev property to audio devs

Aaron Lauterer a.lauterer at proxmox.com
Mon Mar 16 11:02:38 CET 2020


With Qemu 4.2 a new `audiodev` property was introduced [0] to explicitly
specify the backend to be used for the audio device. This is accompanied
with a warning that the fallback to the default audio backend is
deprecated.

[0] https://wiki.qemu.org/ChangeLog/4.2#Audio

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
v1 [1]->v2:
the audiodev property is always set, omitting the machine version check.

tested live migration with all 3 audio devs in both directions.


[1] https://pve.proxmox.com/pipermail/pve-devel/2020-March/042381.html

 PVE/QemuServer.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b2ff515..0905e04 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3221,11 +3221,11 @@ sub config_to_command {
 
 	my $id = $audio->{dev_id};
 	if ($audio->{dev} eq 'AC97') {
-	    push @$devices, '-device', "AC97,id=${id}${audiopciaddr}";
+	    push @$devices, '-device', "AC97,id=${id}${audiopciaddr},audiodev=$audio->{backend_id}";
 	} elsif ($audio->{dev} =~ /intel\-hda$/) {
 	    push @$devices, '-device', "$audio->{dev},id=${id}${audiopciaddr}";
-	    push @$devices, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0";
-	    push @$devices, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1";
+	    push @$devices, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0,audiodev=$audio->{backend_id}";
+	    push @$devices, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1,audiodev=$audio->{backend_id}";
 	} else {
 	    die "unkown audio device '$audio->{dev}', implement me!";
 	}
-- 
2.20.1





More information about the pve-devel mailing list