From 1281c08a46df94a66acca140bafc1785c0fcd47f Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Mon, 30 Jun 2014 17:51:40 -0400 Subject: qga: Disable unsupported commands by default Currently management softwares cannot know whether a qemu-ga command is supported or not on the running platform until they actually execute it. This patch disables unsupported commands at launch time of qemu-ga, so that management softwares can check whether they are supported from 'enabled' property of the result from 'guest-info' command. Signed-off-by: Tomoki Sekiyama Signed-off-by: Michael Roth --- qga/commands-posix.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'qga/commands-posix.c') diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 6b8e9c4809..7eed7f4592 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1955,6 +1955,44 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) } #endif +/* add unsupported commands to the blacklist */ +GList *ga_command_blacklist_init(GList *blacklist) +{ +#if !defined(__linux__) + { + const char *list[] = { + "guest-suspend-disk", "guest-suspend-ram", + "guest-suspend-hybrid", "guest-network-get-interfaces", + "guest-get-vcpus", "guest-set-vcpus", NULL}; + char **p = (char **)list; + + while (*p) { + blacklist = g_list_append(blacklist, *p++); + } + } +#endif + +#if !defined(CONFIG_FSFREEZE) + { + const char *list[] = { + "guest-get-fsinfo", "guest-fsfreeze-status", + "guest-fsfreeze-freeze", "guest-fsfreeze-freeze-list", + "guest-fsfreeze-thaw", "guest-get-fsinfo", NULL}; + char **p = (char **)list; + + while (*p) { + blacklist = g_list_append(blacklist, *p++); + } + } +#endif + +#if !defined(CONFIG_FSTRIM) + blacklist = g_list_append(blacklist, (char *)"guest-fstrim"); +#endif + + return blacklist; +} + /* register init/cleanup routines for stateful command groups */ void ga_command_state_init(GAState *s, GACommandState *cs) { -- cgit v1.2.1