]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: conf: Add 'deprecation_behavior' setting to qemu.conf
authorPeter Krempa <pkrempa@redhat.com>
Thu, 30 Apr 2020 11:27:58 +0000 (13:27 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 6 Apr 2021 15:07:05 +0000 (17:07 +0200)
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@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/libvirtd_qemu.aug
src/qemu/qemu.conf
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/test_libvirtd_qemu.aug.in

index 3c1045858bb52ebbc1314ed4c991e3961f7f8e4f..0f18775121242b93b410b0b0db946470bf96baab 100644 (file)
@@ -131,6 +131,7 @@ module Libvirtd_qemu =
 
    let debug_level_entry = int_entry "gluster_debug_level"
                  | bool_entry "virtiofsd_debug"
+                 | str_entry "deprecation_behavior"
 
    let memory_entry = str_entry "memory_backing_dir"
 
index 0c1054f1984f576b28b782e85774b5fc1913a3b1..8722dc169c77c6016d9eb6bd8a2c2e55d265f755 100644 (file)
 # may change across versions.
 #
 #capability_filters = [ "capname" ]
+
+# 'deprecation_behavior' setting controls how the qemu process behaves towards
+# deprecated commands and arguments used by libvirt.
+#
+# This setting is meant for developers and CI efforts to make it obvious when
+# libvirt relies on fields which are deprecated so that it can be fixes as soon
+# as possible.
+#
+# Possible options are:
+# "none"   - (default) qemu is supposed to accept and output deprecated fields
+#            and commands
+# "omit"   - qemu is instructed to omit deprecated fields on output, behaviour
+#            towards fields and commands from qemu is not changed
+# "reject" - qemu is instructed to report an error if a deprecated command or
+#            field is used by libvirtd
+# "crash"  - qemu crashes when an deprecated command or field is used by libvirtd
+#
+# For both "reject" and "crash" qemu is instructed to omit any deprecated fields
+# on output.
+#
+# The "reject" option is less harsh towards the VMs but some code paths ignore
+# errors reported by qemu and thus it may not be obvious that a deprecated
+# command/field was used, thus it's suggested to use the "crash" option instead.
+#
+# In cases when qemu doesn't support configuring the behaviour this setting is
+# silently ignored to allow testing older qemu versions without having to
+# reconfigure libvirtd.
+#
+# DO NOT use in production.
+#
+#deprecation_behavior = "none"
index d652bf22b199a5b1af02b4ff779ee23bafb8a78f..77fd7f6df74689917edf337f829df973c26af2d6 100644 (file)
@@ -380,6 +380,8 @@ static void virQEMUDriverConfigDispose(void *obj)
     g_free(cfg->swtpmStorageDir);
 
     g_strfreev(cfg->capabilityfilters);
+
+    g_free(cfg->deprecationBehavior);
 }
 
 
@@ -869,6 +871,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPtr cfg,
         return -1;
     if (virConfGetValueBool(conf, "virtiofsd_debug", &cfg->virtiofsdDebug) < 0)
         return -1;
+    if (virConfGetValueString(conf, "deprecation_behavior", &cfg->deprecationBehavior) < 0)
+        return -1;
 
     return 0;
 }
index 7025b5222e8bd3aa883c489cda1d634efa74788f..e62cd889500f3475900df4a4f8b60e9b08ccab32 100644 (file)
@@ -223,6 +223,8 @@ struct _virQEMUDriverConfig {
     gid_t swtpm_group;
 
     char **capabilityfilters;
+
+    char *deprecationBehavior;
 };
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);
index 9310dcec1c802fb1cf75503efa7383484692363a..20a89ade3225330008b513941b9eced22fe39b07 100644 (file)
@@ -115,3 +115,4 @@ module Test_libvirtd_qemu =
 { "capability_filters"
     { "1" = "capname" }
 }
+{ "deprecation_behavior" = "none" }