]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Adapt to new way of specifying PC speaker
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 16 Jun 2023 11:05:48 +0000 (13:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 19 Jul 2023 14:03:31 +0000 (16:03 +0200)
commitecbce923713d736b45696e438ea024e780fd58b7
tree1317d62a0b30a2adbaec2bd01c863dda798ef0cf
parentf9641d2c3771887513b5e92db55fceccb7fadab0
qemu: Adapt to new way of specifying PC speaker

Historically, the way to set PC speaker for a guest was to pass:

  -soundhw pcspk

but as of QEMU commit v5.1.0-rc0~28^2~3 this is deprecated and we
should use:

  -machine pcspk-audiodev=$id

instead. The old way was then removed in commit v7.1.0-rc0~99^2~3.

Now, ideally we would have a capability selecting whether we talk
to a QEMU that understands the new way or not. But it's not that
simple - the machine attribute is just an alias to the .audiodev=
attribute of 'isa-pcspk' object and both are created in
pc_machine_initfn() function, i.e. not then the PC_MACHINE() class
is initialized, but when it's instantiated. IOW, it's not possible
for us to query whether we're dealing with older or newer QEMU.

But given that the newer version is supported since v5.1.0 and the
minimal version we require is v4.2.0 (i.e. there are two releases
which don't understand the newer cmd line) and how frequently this
feature is (un-)used (the issue was reported after ~1 year since it
stopped working), I believe we can live without any capability and
just use the newer cmd line unconditionally.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/490
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/sound-device.x86_64-4.2.0.args
tests/qemuxml2argvdata/sound-device.x86_64-latest.args