#include "virsh.h"
#include "virstring.h"
#include "virxml.h"
+#include "virperf.h"
char **
virshDomainNameCompleter(vshControl *ctl,
return ret;
}
+
+
+char **
+virshDomainPerfEnableCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags)
+{
+ size_t i = 0;
+ VIR_AUTOSTRINGLIST events = NULL;
+ const char *event = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (VIR_ALLOC_N(events, VIR_PERF_EVENT_LAST + 1) < 0)
+ return NULL;
+
+ for (i = 0; i < VIR_PERF_EVENT_LAST; i++)
+ events[i] = g_strdup(virPerfEventTypeToString(i));
+
+ if (vshCommandOptStringQuiet(ctl, cmd, "enable", &event) < 0)
+ return NULL;
+
+ return virshCommaStringListComplete(event, (const char **)events);
+}
+
+
+char **
+virshDomainPerfDisableCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags)
+{
+ size_t i = 0;
+ VIR_AUTOSTRINGLIST events = NULL;
+ const char *event = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (VIR_ALLOC_N(events, VIR_PERF_EVENT_LAST + 1) < 0)
+ return NULL;
+
+ for (i = 0; i < VIR_PERF_EVENT_LAST; i++)
+ events[i] = g_strdup(virPerfEventTypeToString(i));
+
+ if (vshCommandOptStringQuiet(ctl, cmd, "disable", &event) < 0)
+ return NULL;
+
+ return virshCommaStringListComplete(event, (const char **)events);
+}
char ** virshDomainHostnameSourceCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+char ** virshDomainPerfEnableCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
+char ** virshDomainPerfDisableCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "enable",
.type = VSH_OT_STRING,
+ .completer = virshDomainPerfEnableCompleter,
.help = N_("perf events which will be enabled")
},
{.name = "disable",
.type = VSH_OT_STRING,
+ .completer = virshDomainPerfDisableCompleter,
.help = N_("perf events which will be disabled")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,