Description of problem: QEMU now exposes deprecation also using QMP. We need to explore how to use it at least for making sure that new interfaces are used. https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg00645.html
We handle checking of deprecation twofold now: 1) Libvirt's unit tests for monitor interaction now validate that the the code isn't using deprecated fileds: commit de8216af137590801f320f7284338d2c65b8474b Author: Peter Krempa <pkrempa> Date: Wed Mar 4 09:02:54 2020 +0100 testQEMUSchemaValidate*: Reject usage of fields with 'deprecated' set Make our QMP schema validator reject any use of schema entries which were deprecated by QEMU except for those whitelisted. This will allow us to catch this before qemu actually removed what we'd still use. 2) libvirt now exposes a debug interface which can be used to enable '-compat' in qemu. The compat flag allows to configure behavior when an deprecated field is used. The qemu.conf setting 'deprecation_behavior' which should be set to 'crash' in CI environments instructs qemu to crash when a deprecated option is used thus making it very obvious that something like that happened. Additionally the option can be used also for older setups since it's ignored if qemu doesn't support '-compat' to remove the need to fiddle with CI envs. commit c54b1bdcfb9c812a42ff48fe41e2fc8d9a0af86d Author: Peter Krempa <pkrempa> Date: Thu Apr 30 13:34:28 2020 +0200 qemu: command: Handle formatting of '-compat' options Enable '-compat' if requested in qemu.conf and supported by qemu to instruct qemu to crash when a deprecated command is used and stop returning deprecated fields. This setting is meant for libvirt developers and such. Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Martin Kletzander <mkletzan> commit a6444c80195f6b9ad4fe49a6826376c163a02fa5 Author: Peter Krempa <pkrempa> Date: Mon Mar 15 15:06:29 2021 +0100 qemu: Add per-VM control of deprecation behavior Similar to the qemu.conf knob 'deprecation_behavior' add a per-VM knob in the QEMU namespace: <qemu:deprecation behavior='...'/> Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Martin Kletzander <mkletzan> commit 700450449377be4bf923e91d00f8fe8cf0975f66 Author: Peter Krempa <pkrempa> Date: Thu Apr 30 13:27:58 2020 +0200 qemu: conf: Add 'deprecation_behavior' setting to qemu.conf New QEMU supports a harsh, but hard to ignore way to notify that the QMP user used a deprecated command. This is useful e.g. for developers to see that something needs to be fixed. This patch introduces a qemu.conf option to enable the setting in cases when qemu supports it so that developers and continiuous integration efforts are notified about use of deprecated fields before it's too late. The option is deliberately stored as string and not validated to prevent failures when downgrading qemu or libvirt versions. While we don't support this, the knob isn't meant for public consumption anyways. Signed-off-by: Peter Krempa <pkrempa> Reviewed-by: Martin Kletzander <mkletzan>
Set to low Priority&Severity since the comment "# DO NOT use in production".
Indeed, it's specifically designed for testing and CI :)
Since this configuration is aimed for testing not production, I just test it simply to make sure the value of deprecation_behavior will be corresponded to the qemu cmdline Version: libvirt-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64 qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64 Steps 1. Set deprecation_behavior = "crash" in qemu.conf and restart libvirtd 2. Start an VM and check the qemu cmdline. It will be like "/usr/libexec/qemu-kvm ... -compat deprecated-output=hide,deprecated-input=crash ..."
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4684