Signed-off-by: Lin Ma <lma(a)suse.com>
---
tools/virsh-completer-domain.c | 20 ++++++++++++++++++++
tools/virsh-completer-domain.h | 4 ++++
tools/virsh-domain.c | 1 +
3 files changed, 25 insertions(+)
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index dc66317561..b8b6c74f8b 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -711,3 +711,23 @@ virshDomainConsoleCompleter(vshControl *ctl,
return g_steal_pointer(&tmp);
}
+
+char **
+virshDomainSignalCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ size_t i = 0;
+ VIR_AUTOSTRINGLIST tmp = NULL;
+
+ virCheckFlags(0, NULL);
+
+ tmp = g_new0(char *, VIR_DOMAIN_PROCESS_SIGNAL_LAST + 1);
+
+ for (i = 0; i < VIR_DOMAIN_PROCESS_SIGNAL_LAST; i++) {
+ const char *name = virDomainProcessSignalTypeToString(i);
+ tmp[i] = g_strdup(name);
+ }
+
+ return g_steal_pointer(&tmp);
+}
diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h
index 02fea2fe94..cdec66f23e 100644
--- a/tools/virsh-completer-domain.h
+++ b/tools/virsh-completer-domain.h
@@ -98,3 +98,7 @@ char ** virshDomainVcpulistViaAgentCompleter(vshControl *ctl,
char ** virshDomainConsoleCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+char ** virshDomainSignalCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 472b510a6b..1406bb4583 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8905,6 +8905,7 @@ static const vshCmdOptDef opts_send_process_signal[] = {
{.name = "signame",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+ .completer = virshDomainSignalCompleter,
.help = N_("the signal number or name")
},
{.name = NULL}
--
2.26.0