[RFC PATCH 2/3] qemu: conf: Add 'deprecated_debug' setting to qemu.conf

Peter Krempa pkrempa at redhat.com
Thu Apr 30 14:13:43 UTC 2020


New QEMU supports an harsh, but hard to ignore way to notify that the
QMP user used an 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 while it's not late.
---
 src/qemu/libvirtd_qemu.aug         |  1 +
 src/qemu/qemu.conf                 | 11 +++++++++++
 src/qemu/qemu_conf.c               |  2 ++
 src/qemu/qemu_conf.h               |  2 ++
 src/qemu/test_libvirtd_qemu.aug.in |  1 +
 5 files changed, 17 insertions(+)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 404498b611..4cf700346f 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -118,6 +118,7 @@ module Libvirtd_qemu =

    let debug_level_entry = int_entry "gluster_debug_level"
                  | bool_entry "virtiofsd_debug"
+                 | bool_entry "deprecated_debug"

    let memory_entry = str_entry "memory_backing_dir"

diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index abdbf07fec..558731da0f 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -852,3 +852,14 @@
 # may change across versions.
 #
 #capability_filters = [ "capname" ]
+
+# 'deprecated_debug' setting controls whether qemu should be instructed to crash
+# when libvirt uses deprecated commands or arguments and at the same time to
+# stop including deprecated fields in replies. This setting is meant for
+# developers and continious-integration efforts to make it obvious when
+# we rely on features which may go away. In cases when qemu doesn't support
+# dealing with deprecated fields the setting is ignored.
+#
+# DO NOT use in production.
+#
+#deprecated_debug = 1
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c59824006c..34286bf388 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -846,6 +846,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPtr cfg,
         return -1;
     if (virConfGetValueBool(conf, "virtiofsd_debug", &cfg->virtiofsdDebug) < 0)
         return -1;
+    if (virConfGetValueBool(conf, "deprecated_debug", &cfg->deprecatedDebug) < 0)
+        return -1;

     return 0;
 }
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index b9ef4551a3..830e7f320d 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -218,6 +218,8 @@ struct _virQEMUDriverConfig {
     gid_t swtpm_group;

     char **capabilityfilters;
+
+    bool deprecatedDebug;
 };

 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index 19da591aae..a45003633f 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -111,3 +111,4 @@ module Test_libvirtd_qemu =
 { "capability_filters"
     { "1" = "capname" }
 }
+{ "deprecated_debug" = "1" }
-- 
2.26.2




More information about the libvir-list mailing list