Patchwork [5/8] QMP: Introduce qmp_capability_enable/disable

login
register
mail settings
Submitter Luiz Capitulino
Date Jan. 28, 2010, 1:42 p.m.
Message ID <1264686180-29845-6-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/43863/
State New
Headers show

Comments

Luiz Capitulino - Jan. 28, 2010, 1:42 p.m.
As we don't have any capabilities yet, they always return an
InvalidParameter error.

Please, also note that:

o They don't accept an json-array yet, because this would require
not so simple changes and it's not useful right now

o We will need more infrastructure to have capabilities per Monitor,
which is not going to be done now as we don't need this yet either

Usage example:

{ "execute": "qmp_capability_enable", "arguments": { "name": "foo" } }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |   14 ++++++++++++++
 qemu-monitor.hx |   30 ++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index f6dd64d..9070a0c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -730,6 +730,20 @@  static void do_qmp_switch_mode(Monitor *mon, const QDict *qdict,
     }
 }
 
+static void do_qmp_capability_enable(Monitor *mon, const QDict *qdict,
+                                     QObject **ret_data)
+{
+    /* QMP doesn't have any capabilities yet */
+    qemu_error_new(QERR_INVALID_PARAMETER, "name");
+}
+
+static void do_qmp_capability_disable(Monitor *mon, const QDict *qdict,
+                                      QObject **ret_data)
+{
+    /* QMP doesn't have any capabilities yet */
+    qemu_error_new(QERR_INVALID_PARAMETER, "name");
+}
+
 /**
  * do_info_commands(): List QMP available commands
  *
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 29155ce..8905986 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -1079,6 +1079,36 @@  STEXI
 Switch QMP to @var{mode}
 ETEXI
 
+    {
+        .name       = "qmp_capability_enable",
+        .args_type  = "name:s",
+        .params     = "name",
+        .help       = "enable a QMP capability",
+        .flags      = HANDLER_HANDSHAKE_ONLY,
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_qmp_capability_enable,
+    },
+
+STEXI
+@item qmp_capability_enable @var{name}
+Enable QMP capability @{name}
+ETEXI
+
+    {
+        .name       = "qmp_capability_disable",
+        .args_type  = "name:s",
+        .params     = "name",
+        .help       = "disable a QMP capability",
+        .flags      = HANDLER_HANDSHAKE_ONLY,
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_qmp_capability_disable,
+    },
+
+STEXI
+@item qmp_capability_disable @var{name}
+Disable QMP capability @{name}
+ETEXI
+
 STEXI
 @end table
 ETEXI