The completer is trivial, just iterate over
virDomainNumatuneMemMode enum and convert each integer into its
string comrade.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-completer-domain.c | 20 ++++++++++++++++++++
tools/virsh-completer-domain.h | 5 +++++
tools/virsh-domain.c | 1 +
3 files changed, 26 insertions(+)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index 93e992e9b1..b4e744c1ba 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -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;
+}
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index ec7909888e..94bb3b5e5c 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -181,3 +181,8 @@ char **
virshDomainBlockjobBaseTopCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+char **
+virshDomainNumatuneModeCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c748fe2ba9..f086c2dd4b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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")
},
--
2.32.0