This prints a warning on stderr every time a policy violation is encountered, but accepts the input.
Signed-off-by: Daniel P. Berrangé <[email protected]> --- qapi/compat.json | 4 +++- qapi/qapi-util.c | 4 ++++ qemu-options.hx | 12 ++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/qapi/compat.json b/qapi/compat.json index 0f90ea1f524..dfa3fea0577 100644 --- a/qapi/compat.json +++ b/qapi/compat.json @@ -17,10 +17,12 @@ # # @crash: abort() the process # +# @warn: Accept with a warning printed to stderr (Since: 11.2) +# # Since: 6.0 ## { 'enum': 'CompatPolicyInput', - 'data': [ 'accept', 'reject', 'crash' ] } + 'data': [ 'accept', 'reject', 'crash', 'warn' ] } ## # @CompatPolicyOutput: diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c index 93898f57a05..f81a171a5b1 100644 --- a/qapi/qapi-util.c +++ b/qapi/qapi-util.c @@ -28,6 +28,10 @@ static bool compat_policy_input_ok1(CompatPolicyInput policy, switch (policy) { case COMPAT_POLICY_INPUT_ACCEPT: return true; + case COMPAT_POLICY_INPUT_WARN: + warn_report("%s %s %s disabled by policy", + adjective, kind, name); + return true; case COMPAT_POLICY_INPUT_REJECT: error_set(errp, error_class, "%s %s %s disabled by policy", adjective, kind, name); diff --git a/qemu-options.hx b/qemu-options.hx index f72f30e246d..16d9c6c9072 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4693,9 +4693,9 @@ DEFHEADING() DEFHEADING(Debug/Expert options:) DEF("compat", HAS_ARG, QEMU_OPTION_compat, - "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept|hide]\n" + "-compat [deprecated-input=accept|reject|crash|warn][,deprecated-output=accept|hide]\n" " Policy for handling deprecated management interfaces\n" - "-compat [unstable-input=accept|reject|crash][,unstable-output=accept|hide]\n" + "-compat [unstable-input=accept|reject|crash|warn][,unstable-output=accept|hide]\n" " Policy for handling unstable management interfaces\n", QEMU_ARCH_ALL) SRST @@ -4703,7 +4703,9 @@ SRST Set policy for handling deprecated management interfaces (experimental): ``deprecated-input=accept`` (default) - Accept deprecated commands and arguments + Accept deprecated commands and arguments silently + ``deprecated-input=warn`` + Accept deprecated commands and arguments with warning on stderr ``deprecated-input=reject`` Reject deprecated commands and arguments ``deprecated-input=crash`` @@ -4719,7 +4721,9 @@ SRST Set policy for handling unstable management interfaces (experimental): ``unstable-input=accept`` (default) - Accept unstable commands and arguments + Accept unstable commands and arguments silently + ``unstable-input=warn`` + Accept unstable commands and arguments with warning on stderr ``unstable-input=reject`` Reject unstable commands and arguments ``unstable-input=crash`` -- 2.56.0
