[PATCH 2/6] qemu: capabilities: Introduce QEMU_CAPS_COMPAT_DEPRECATED

Peter Krempa pkrempa at redhat.com
Thu Apr 1 08:07:15 UTC 2021


On Thu, Apr 01, 2021 at 00:05:55 +0200, Martin Kletzander wrote:
> On Fri, Mar 19, 2021 at 07:33:50PM +0100, Peter Krempa wrote:
> > The capability is asserted if qemu supports the -compat
> > deprecated-input= and deprecated-output= settings to control what should
> > happen if deprecated fields are used in QMP.
> > 
> > This will be used for a developer/tester-oriented setting which will
> > aid us in catching use of deprecated settings sooner.
> > 
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> > src/qemu/qemu_capabilities.c                     | 8 ++++++++
> > src/qemu/qemu_capabilities.h                     | 1 +
> > tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
> > 3 files changed, 10 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> > index dc1b10cd66..beea57caf6 100644
> > --- a/src/qemu/qemu_capabilities.c
> > +++ b/src/qemu/qemu_capabilities.c
> > @@ -624,6 +624,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
> >               "audiodev",
> >               "blockdev-backup",
> >               "object.qapified",
> > +              "compat-deprecated",
> >     );
> > 
> > 
> > @@ -5187,6 +5188,13 @@ virQEMUCapsInitProcessCapsInterlock(virQEMUCapsPtr qemuCaps)
> > 
> >     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV))
> >         virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI);
> > +
> > +    /* The -compat qemu command line argument is implemented using a newer
> > +     * method which doesn't show up in query-command-line-options. As we'll use
> > +     * it only for development and testing purposes we can base the capability
> > +     * on a not entirely related witness. */
> > +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_QAPIFIED))
> > +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_COMPAT_DEPRECATED);
> 
> Or it could be just enabled by default since it should be used by devs
> and CI only.

The idea here is that the capability will be used to hide the option
from qemus which don't support it, so that you can e.g. downgrade your
qemu or switch from git and non-git versions wihout having to touch this
option.

qemu-5.2.0:

./qemu-system-x86_64 -compat
qemu-system-x86_64: -compat: invalid option





More information about the libvir-list mailing list