提交 cac6d413 编写于 作者: L Lin Ma 提交者: Michal Privoznik

virsh: Add event name completion to 'pool-event' command

Signed-off-by: NLin Ma <lma@suse.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 237fe904
......@@ -703,3 +703,29 @@ virshDomainEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virStringListFree(ret);
return NULL;
}
char **
virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
const vshCmd *cmd ATTRIBUTE_UNUSED,
unsigned int flags)
{
size_t i = 0;
char **ret = NULL;
virCheckFlags(0, NULL);
if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST) < 0)
goto error;
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) {
if (VIR_STRDUP(ret[i], virshPoolEventCallbacks[i].name) < 0)
goto error;
}
return ret;
error:
virStringListFree(ret);
return NULL;
}
......@@ -86,4 +86,8 @@ char ** virshDomainEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
char ** virshPoolEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
#endif
......@@ -2098,6 +2098,7 @@ static const vshCmdOptDef opts_pool_event[] = {
},
{.name = "event",
.type = VSH_OT_STRING,
.completer = virshPoolEventNameCompleter,
.help = N_("which event type to wait for")
},
{.name = "loop",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册