mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh-completer: Provide completer for numatune --mode
The completer is trivial, just iterate over virDomainNumatuneMemMode enum and convert each integer into its string comrade. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d05a89b703
commit
dfd1ffc544
@ -37,6 +37,7 @@
|
||||
#include "virkeynametable_osx.h"
|
||||
#include "virkeynametable_win32.h"
|
||||
#include "conf/storage_conf.h"
|
||||
#include "conf/numa_conf.h"
|
||||
|
||||
char **
|
||||
virshDomainNameCompleter(vshControl *ctl,
|
||||
@ -1130,3 +1131,22 @@ virshDomainStorageFileFormatCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshDomainNumatuneModeCompleter(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_NUMATUNE_MEM_LAST + 1);
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_NUMATUNE_MEM_LAST; i++)
|
||||
ret[i] = g_strdup(virDomainNumatuneMemModeTypeToString(i));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -181,3 +181,8 @@ char **
|
||||
virshDomainBlockjobBaseTopCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **
|
||||
virshDomainNumatuneModeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -9407,6 +9407,7 @@ static const vshCmdOptDef opts_numatune[] = {
|
||||
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
|
||||
{.name = "mode",
|
||||
.type = VSH_OT_STRING,
|
||||
.completer = virshDomainNumatuneModeCompleter,
|
||||
.help = N_("NUMA mode, one of strict, preferred and interleave \n"
|
||||
"or a number from the virDomainNumatuneMemMode enum")
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user