]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Add comp-methods completion to migrate command
authorLin Ma <lma@suse.com>
Tue, 15 Jun 2021 00:38:21 +0000 (08:38 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Jun 2021 08:27:47 +0000 (10:27 +0200)
Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-completer-domain.c
tools/virsh-completer-domain.h
tools/virsh-domain.c

index 20d503ff09c83b400c1655034de55bfc5e0390a2..256ac0b59320261c702375808f36cf29de16a40f 100644 (file)
@@ -959,3 +959,20 @@ virshDomainCoreDumpFormatCompleter(vshControl *ctl G_GNUC_UNUSED,
 
     return ret;
 }
+
+
+char **
+virshDomainMigrateCompMethodsCompleter(vshControl *ctl,
+                                       const vshCmd *cmd,
+                                       unsigned int flags)
+{
+    const char *methods[] = {"xbzrle", "mt",  NULL};
+    const char *method = NULL;
+
+    virCheckFlags(0, NULL);
+
+    if (vshCommandOptStringQuiet(ctl, cmd, "comp-methods", &method) < 0)
+        return NULL;
+
+    return virshCommaStringListComplete(method, methods);
+}
index 4e16d845145190a1a57940743dc26d4ef8c06783..5d5609050444fe895cc406906a0b0f2c3f452bc3 100644 (file)
@@ -127,3 +127,8 @@ char **
 virshDomainCoreDumpFormatCompleter(vshControl *ctl,
                                    const vshCmd *cmd,
                                    unsigned int flags);
+
+char **
+virshDomainMigrateCompMethodsCompleter(vshControl *ctl,
+                                       const vshCmd *cmd,
+                                       unsigned int flags);
index ecad3a5e5dcd31e2d58bc3b42dc84ef26fd96680..0100652e76f052ef2e66c0a79ce23183a0b4dda6 100644 (file)
@@ -10619,6 +10619,7 @@ static const vshCmdOptDef opts_migrate[] = {
     },
     {.name = "comp-methods",
      .type = VSH_OT_STRING,
+     .completer = virshDomainMigrateCompMethodsCompleter,
      .help = N_("comma separated list of compression methods to be used")
     },
     {.name = "comp-mt-level",