]> git.proxmox.com Git - mirror_qemu.git/commitdiff
monitor: more accurate completion for host_net_remove()
authorJason Wang <jasowang@redhat.com>
Mon, 2 Feb 2015 07:06:38 +0000 (15:06 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 6 Feb 2015 14:06:45 +0000 (14:06 +0000)
Current completion for host_net_remove will show hub ports and clients
that were not peered with hub ports. Fix this.

Cc: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-id: 1422860798-17495-4-git-send-email-jasowang@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
monitor.c

index 7e4f605e6d229ae3d91b559e108591880e0c355c..e6dc50aa33a1bf6573addb153789b06803f8226e 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4597,8 +4597,13 @@ void host_net_remove_completion(ReadLineState *rs, int nb_args, const char *str)
         count = qemu_find_net_clients_except(NULL, ncs,
                                              NET_CLIENT_OPTIONS_KIND_NIC, 255);
         for (i = 0; i < count; i++) {
+            int id;
             const char *name;
 
+            if (ncs[i]->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT ||
+                net_hub_id_for_client(ncs[i], &id)) {
+                continue;
+            }
             name = ncs[i]->name;
             if (!strncmp(str, name, len)) {
                 readline_add_completion(rs, name);