aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-05-07 23:41:32 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-05-15 15:16:02 -0400
commit11b389f21e4531c23fb8a8474bc8fc7ac2e136a5 (patch)
treea1b0a07ed577464eb72916ef7d57c68ffce24c31 /monitor.c
parentb162b49adc4cc6aa2c2ed0a31998f23dfe5983e6 (diff)
monitor: Add netdev_del id argument completion.
Signed-off-by: Hani Benhabiles <hani@linux.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index a3dd3614fc..593679a17a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4493,6 +4493,32 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str)
}
}
+void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
+{
+ int len, count, i;
+ NetClientState *ncs[255];
+
+ if (nb_args != 2) {
+ return;
+ }
+
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ count = qemu_find_net_clients_except(NULL, ncs, NET_CLIENT_OPTIONS_KIND_NIC,
+ 255);
+ for (i = 0; i < count; i++) {
+ QemuOpts *opts;
+ const char *name = ncs[i]->name;
+ if (strncmp(str, name, len)) {
+ continue;
+ }
+ opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), name);
+ if (opts) {
+ readline_add_completion(rs, name);
+ }
+ }
+}
+
static void monitor_find_completion_by_table(Monitor *mon,
const mon_cmd_t *cmd_table,
char **args,