mirror of https://gitee.com/openkylin/libvirt.git
virsh: Add event name completion to 'pool-event' command
Signed-off-by: Lin Ma <lma@suse.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
237fe904e9
commit
cac6d413f9
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue