Add the `,audiodev=` property to audio devices when machine version is 4.2 or higher.
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.laute...@proxmox.com> --- tested this with all 3 audio devices available in a local VM and one live migration from a qemu 4.1 node to a 4.2 node with the default ich9-intel-hda dev. PVE/QemuServer.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b2ff515..6808623 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3220,12 +3220,18 @@ sub config_to_command { my $audiopciaddr = print_pci_addr("audio0", $bridges, $arch, $machine_type); my $id = $audio->{dev_id}; + + my $audiodevsuffix = ''; + if (min_version($machine_version, 4, 2)) { + $audiodevsuffix = ",audiodev=$audio->{backend_id}"; + } + if ($audio->{dev} eq 'AC97') { - push @$devices, '-device', "AC97,id=${id}${audiopciaddr}"; + push @$devices, '-device', "AC97,id=${id}${audiopciaddr}${audiodevsuffix}"; } 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${audiodevsuffix}"; + push @$devices, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1${audiodevsuffix}"; } else { die "unkown audio device '$audio->{dev}', implement me!"; } -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel