Signed-off-by: Lin Ma <lma@xxxxxxxx> --- tools/virsh-completer-domain.c | 17 +++++++++++++++++ tools/virsh-completer-domain.h | 5 +++++ tools/virsh-domain.c | 1 + 3 files changed, 23 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 20d503ff09..256ac0b593 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -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); +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index 4e16d84514..5d56090504 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -127,3 +127,8 @@ char ** virshDomainCoreDumpFormatCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshDomainMigrateCompMethodsCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ecad3a5e5d..0100652e76 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -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", -- 2.26.2