Skip to content

Commit

Permalink
monitor: Add migrate_set_capability completion
Browse files Browse the repository at this point in the history
Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
kroosec authored and Luiz Capitulino committed Jun 11, 2014
1 parent d0ece34 commit c68a040
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions hmp-commands.hx
Expand Up @@ -975,6 +975,7 @@ ETEXI
.params = "capability state",
.help = "Enable/Disable the usage of a capability for migration",
.mhandler.cmd = hmp_migrate_set_capability,
.command_completion = migrate_set_capability_completion,
},
STEXI
Expand Down
2 changes: 2 additions & 0 deletions hmp.h
Expand Up @@ -107,5 +107,7 @@ void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str);
void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str);
void watchdog_action_completion(ReadLineState *rs, int nb_args,
const char *str);
void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
const char *str);

#endif
21 changes: 21 additions & 0 deletions monitor.c
Expand Up @@ -4573,6 +4573,27 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
add_completion_option(rs, str, "none");
}

void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
const char *str)
{
size_t len;

len = strlen(str);
readline_set_completion_index(rs, len);
if (nb_args == 2) {
int i;
for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) {
const char *name = MigrationCapability_lookup[i];
if (!strncmp(str, name, len)) {
readline_add_completion(rs, name);
}
}
} else if (nb_args == 3) {
add_completion_option(rs, str, "on");
add_completion_option(rs, str, "off");
}
}

static void monitor_find_completion_by_table(Monitor *mon,
const mon_cmd_t *cmd_table,
char **args,
Expand Down

0 comments on commit c68a040

Please sign in to comment.