diff mbox series

[RFC,17/19] qapi: Implement -compat deprecated-input=crash for commands

Message ID 20191024123458.13505-18-armbru@redhat.com (mailing list archive)
State New, archived
Headers show
Series Configurable policy for handling deprecated interfaces | expand

Commit Message

Markus Armbruster Oct. 24, 2019, 12:34 p.m. UTC
This policy calls abort() when a deprecated command is received.

Crashing should reliably[*] fail existing integration tests with very
little additional work (just pass the option).

[*] Bugs in tests can conceivably mask even crashes, but that seems
unlikely.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qapi/common.json    | 4 ++--
 qapi/qmp-dispatch.c | 1 +
 qemu-options.hx     | 4 +++-
 3 files changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/qapi/common.json b/qapi/common.json
index 3e9d12c90f..06e54642bb 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -152,14 +152,14 @@ 
 #
 # @accept: Accept silently
 # @reject: Reject with an error
-# TODO @crash: abort() the process
+# @crash: abort() the process
 #
 # FIXME Guidance on intended use.
 #
 # Since: 4.2
 ##
 { 'enum': 'CompatPolicyInput',
-  'data': [ 'accept', 'reject' ] }
+  'data': [ 'accept', 'reject', 'crash' ] }
 
 ##
 # @CompatPolicyOutput:
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index b079db85d2..6436417844 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -141,6 +141,7 @@  QDict *qmp_dispatch(QmpCommandList *cmds, QObject *request,
                       "Deprecated command %s disabled by policy",
                       command);
             goto out;
+        case COMPAT_POLICY_INPUT_CRASH:
         default:
             abort();
         }
diff --git a/qemu-options.hx b/qemu-options.hx
index f107a57c81..3a740ea7b1 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3320,7 +3320,7 @@  STEXI
 ETEXI
 
 DEF("compat", HAS_ARG, QEMU_OPTION_compat,
-    "-compat [deprecated-input=accept|reject][,deprecated-output=accept]\n"
+    "-compat [deprecated-input=accept|reject|crash][,deprecated-output=accept]\n"
     "                Policy for handling deprecated management interfaces\n",
     QEMU_ARCH_ALL)
 STEXI
@@ -3333,6 +3333,8 @@  Set policy for handling deprecated management interfaces:
 Accept deprecated commands
 @item deprecated-input=reject
 Reject deprecated commands
+@item deprecated-input=crash
+Crash on deprecated command
 @item deprecated-output=accept (default)
 Emit deprecated events
 @end table