aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-05-08 14:24:44 -0300
committerMichael Roth <mdroth@linux.vnet.ibm.com>2012-05-15 09:15:16 -0500
commitd34b867d816585900b72d09d42a34cea3057903d (patch)
tree2aa501d2c933659db2597959c1349be2268a86b0 /scripts
parent76ee152a86d5f2533443ce4d2be6fe253cfb3c45 (diff)
qapi: add support for command options
Options allow for changes in commands behavior. This commit introduces the QCO_NO_SUCCESS_RESP option, which causes a command to not emit a success response. This is needed by commands such as qemu-ga's guest-shutdown, which may not be able to complete before the VM vanishes. In this case, it's useful and simpler not to bother sending a success response. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-commands.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 0b4f0a0fe1..9eed40e18a 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -291,14 +291,24 @@ out:
return ret
+def option_value_matches(opt, val, cmd):
+ if opt in cmd and cmd[opt] == val:
+ return True
+ return False
+
def gen_registry(commands):
registry=""
push_indent()
for cmd in commands:
+ options = 'QCO_NO_OPTIONS'
+ if option_value_matches('success-response', 'no', cmd):
+ options = 'QCO_NO_SUCCESS_RESP'
+
registry += mcgen('''
-qmp_register_command("%(name)s", qmp_marshal_input_%(c_name)s);
+qmp_register_command("%(name)s", qmp_marshal_input_%(c_name)s, %(opts)s);
''',
- name=cmd['command'], c_name=c_fun(cmd['command']))
+ name=cmd['command'], c_name=c_fun(cmd['command']),
+ opts=options)
pop_indent()
ret = mcgen('''
static void qmp_init_marshal(void)