virsh: Add coredump format completion to dump command

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Lin Ma 2021-06-07 11:14:18 +08:00 committed by Michal Privoznik
parent 84cc4543be
commit 564512e916
3 changed files with 26 additions and 0 deletions

View File

@ -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;
}

View File

@ -122,3 +122,8 @@ char ** virshKeycodeNameCompleter(vshControl *ctl,
char ** virshDomainFSMountpointsCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
char **
virshDomainCoreDumpFormatCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);

View File

@ -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}