aboutsummaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorTomoki Sekiyama <tomoki.sekiyama@hds.com>2014-06-30 17:51:40 -0400
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-08-07 17:15:53 -0500
commit1281c08a46df94a66acca140bafc1785c0fcd47f (patch)
tree666a303743ddc930d1c2996ced364c8d00556406 /qga
parent46d4c5723e438be0fa564b8adeefed8f40f4a6ca (diff)
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 <tomoki.sekiyama@hds.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-posix.c38
-rw-r--r--qga/commands-win32.c32
-rw-r--r--qga/guest-agent-core.h1
-rw-r--r--qga/main.c1
4 files changed, 71 insertions, 1 deletions
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)
{
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 3b667f5226..3bcbeae8ff 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -446,10 +446,40 @@ int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
return -1;
}
+/* add unsupported commands to the blacklist */
+GList *ga_command_blacklist_init(GList *blacklist)
+{
+ const char *list_unsupported[] = {
+ "guest-file-open", "guest-file-close", "guest-file-read",
+ "guest-file-write", "guest-file-seek", "guest-file-flush",
+ "guest-suspend-hybrid", "guest-network-get-interfaces",
+ "guest-get-vcpus", "guest-set-vcpus",
+ "guest-fsfreeze-freeze-list", "guest-get-fsinfo",
+ "guest-fstrim", NULL};
+ char **p = (char **)list_unsupported;
+
+ while (*p) {
+ blacklist = g_list_append(blacklist, *p++);
+ }
+
+ if (!vss_init(true)) {
+ const char *list[] = {
+ "guest-get-fsinfo", "guest-fsfreeze-status",
+ "guest-fsfreeze-freeze", "guest-fsfreeze-thaw", NULL};
+ p = (char **)list;
+
+ while (*p) {
+ blacklist = g_list_append(blacklist, *p++);
+ }
+ }
+
+ return blacklist;
+}
+
/* register init/cleanup routines for stateful command groups */
void ga_command_state_init(GAState *s, GACommandState *cs)
{
- if (vss_init(true)) {
+ if (!vss_initialized()) {
ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup);
}
}
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index e422208b4e..e92c6abafb 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -19,6 +19,7 @@ typedef struct GAState GAState;
typedef struct GACommandState GACommandState;
extern GAState *ga_state;
+GList *ga_command_blacklist_init(GList *blacklist);
void ga_command_state_init(GAState *s, GACommandState *cs);
void ga_command_state_add(GACommandState *cs,
void (*init)(void),
diff --git a/qga/main.c b/qga/main.c
index 8b927c9db7..227f2bdb88 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1144,6 +1144,7 @@ int main(int argc, char **argv)
goto out_bad;
}
+ blacklist = ga_command_blacklist_init(blacklist);
if (blacklist) {
s->blacklist = blacklist;
do {