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

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

Signed-off-by: NLin Ma <lma@suse.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 a9f6b8fc
......@@ -26,6 +26,7 @@
#include "virsh-domain.h"
#include "virsh.h"
#include "virsh-pool.h"
#include "virsh-nodedev.h"
#include "virsh-util.h"
#include "virsh-secret.h"
#include "internal.h"
......@@ -729,3 +730,29 @@ virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virStringListFree(ret);
return NULL;
}
char **
virshNodedevEventNameCompleter(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_NODE_DEVICE_EVENT_ID_LAST) < 0)
goto error;
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) {
if (VIR_STRDUP(ret[i], virshNodedevEventCallbacks[i].name) < 0)
goto error;
}
return ret;
error:
virStringListFree(ret);
return NULL;
}
......@@ -90,4 +90,8 @@ char ** virshPoolEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
char ** virshNodedevEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
#endif
......@@ -870,6 +870,7 @@ static const vshCmdOptDef opts_node_device_event[] = {
},
{.name = "event",
.type = VSH_OT_STRING,
.completer = virshNodedevEventNameCompleter,
.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.
先完成此消息的编辑!
想要评论请 注册