fixes behavior introduced with commit 940e2a3a06b3ea47aae144519e2aaa881a80e437
Qemu 4.1 will fail to start a guest with an audio device set with `Property '.audiodev' not found`. Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com> --- Users reported this problem in the forum today [0]. I was able to reproduce this problem which makes me somewhat dumbfounded how I missed that while testing the initial commit... :/ [0] https://forum.proxmox.com/threads/kein-kvm-start-mehr-nach-heutigem-update.69379 PVE/QemuServer.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index cb96b71..c50f102 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2752,19 +2752,22 @@ sub conf_has_audio { } sub audio_devs { - my ($audio, $audiopciaddr) = @_; + my ($audio, $audiopciaddr, $machine_version) = @_; my $devs = []; my $id = $audio->{dev_id}; - my $audiodev = "audiodev=$audio->{backend_id}"; + my $audiodev = ""; + if (min_version($machine_version, 4, 2)) { + $audiodev = ",audiodev=$audio->{backend_id}"; + } if ($audio->{dev} eq 'AC97') { - push @$devs, '-device', "AC97,id=${id}${audiopciaddr},$audiodev"; + push @$devs, '-device', "AC97,id=${id}${audiopciaddr}$audiodev"; } elsif ($audio->{dev} =~ /intel\-hda$/) { push @$devs, '-device', "$audio->{dev},id=${id}${audiopciaddr}"; - push @$devs, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0,$audiodev"; - push @$devs, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1,$audiodev"; + push @$devs, '-device', "hda-micro,id=${id}-codec0,bus=${id}.0,cad=0$audiodev"; + push @$devs, '-device', "hda-duplex,id=${id}-codec1,bus=${id}.0,cad=1$audiodev"; } else { die "unkown audio device '$audio->{dev}', implement me!"; } @@ -3275,7 +3278,7 @@ sub config_to_command { if (min_version($machine_version, 4, 0) && (my $audio = conf_has_audio($conf))) { my $audiopciaddr = print_pci_addr("audio0", $bridges, $arch, $machine_type); - my $audio_devs = audio_devs($audio, $audiopciaddr); + my $audio_devs = audio_devs($audio, $audiopciaddr, $machine_version); push @$devices, @$audio_devs; } -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel