aboutsummaryrefslogtreecommitdiff
path: root/qapi/qmp-dispatch.c
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 /qapi/qmp-dispatch.c
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 'qapi/qmp-dispatch.c')
-rw-r--r--qapi/qmp-dispatch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 43f640a95e..122c1a29ba 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -94,8 +94,12 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp)
switch (cmd->type) {
case QCT_NORMAL:
cmd->fn(args, &ret, errp);
- if (!error_is_set(errp) && ret == NULL) {
- ret = QOBJECT(qdict_new());
+ if (!error_is_set(errp)) {
+ if (cmd->options & QCO_NO_SUCCESS_RESP) {
+ g_assert(!ret);
+ } else if (!ret) {
+ ret = QOBJECT(qdict_new());
+ }
}
break;
}