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@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Peter Krempa 2020-04-30 13:27:58 +02:00
parent d8793c6832
commit 7004504493
5 changed files with 39 additions and 0 deletions

View 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"

View File

@ -922,3 +922,34 @@
# 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"

View 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;
}

View File

@ -223,6 +223,8 @@ struct _virQEMUDriverConfig {
gid_t swtpm_group;
char **capabilityfilters;
char *deprecationBehavior;
};
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);

View File

@ -115,3 +115,4 @@ module Test_libvirtd_qemu =
{ "capability_filters"
{ "1" = "capname" }
}
{ "deprecation_behavior" = "none" }