Signed-off-by: Lin Ma <lma@xxxxxxxx> --- tools/virsh-completer-domain.c | 19 +++++++++++++++++++ tools/virsh-completer-domain.h | 5 +++++ tools/virsh-domain.c | 2 ++ 3 files changed, 26 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 1f72b856b4..20d503ff09 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -940,3 +940,22 @@ virshDomainFSMountpointsCompleter(vshControl *ctl, virshDomainFree(dom); return ret; } + + +char ** +virshDomainCoreDumpFormatCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + char **ret = NULL; + size_t i; + + virCheckFlags(0, NULL); + + ret = g_new0(char *, VIR_DOMAIN_CORE_DUMP_FORMAT_LAST + 1); + + for (i = 0; i < VIR_DOMAIN_CORE_DUMP_FORMAT_LAST; i++) + ret[i] = g_strdup(virDomainCoreDumpFormatTypeToString(i)); + + return ret; +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index ef242d0c68..f548f7ba9e 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -122,3 +122,8 @@ char ** virshKeycodeNameCompleter(vshControl *ctl, char ** virshDomainFSMountpointsCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshDomainCoreDumpFormatCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 78276dd847..ecad3a5e5d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5405,6 +5405,8 @@ static const vshCmdOptDef opts_dump[] = { }, {.name = "format", .type = VSH_OT_STRING, + .flags = VSH_OFLAG_NONE, + .completer = virshDomainCoreDumpFormatCompleter, .help = N_("specify the format of memory-only dump") }, {.name = NULL} -- 2.26.2