>From 90df6dc8a3278800f9f9dc23f626df5fa00b5950 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 21 Sep 2020 13:18:05 +0100 Subject: [PATCH] lib: direct: Pass qemu -compat to detect deprecated features. In developer versions of libguestfs only, pass the qemu -compat option which will reject deprecated qemu features, giving us early warning if we are using something that may be removed in future. This does not affect stable branch builds or old versions of qemu which did not have this flag. --- lib/guestfs-internal.h | 3 +++ lib/launch-direct.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h index d7ec7215d..4ad1cd125 100644 --- a/lib/guestfs-internal.h +++ b/lib/guestfs-internal.h @@ -33,6 +33,9 @@ #include +/* Is this a developer version of libguestfs? */ +#define IS_DEVELOPER_VERSION ((PACKAGE_VERSION_MINOR & 1) == 1) + /* Minimum required version of libvirt for the libvirt backend. * * This is also checked at runtime because you can dynamically link diff --git a/lib/launch-direct.c b/lib/launch-direct.c index b6ed9766f..3e42609ff 100644 --- a/lib/launch-direct.c +++ b/lib/launch-direct.c @@ -501,6 +501,17 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) if (guestfs_int_qemu_supports (g, data->qemu_data, "-enable-fips")) flag ("-enable-fips"); + /* In non-stable versions of libguestfs, pass the -compat option to + * qemu so we can look for potentially deprecated features. + */ + if (IS_DEVELOPER_VERSION && + guestfs_int_qemu_supports (g, data->qemu_data, "-compat")) { + start_list ("-compat") { + append_list ("deprecated-input=reject"); + append_list ("deprecated-output=hide"); + } end_list (); + } + /* Newer versions of qemu (from around 2009/12) changed the * behaviour of monitors so that an implicit '-monitor stdio' is * assumed if we are in -nographic mode and there is no other -- 2.28.0.rc2