diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 9423d2efb3..6da603048e 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -24,6 +24,7 @@ #include "viralloc.h" #include "virmacaddr.h" #include "virsh-domain.h" +#include "virsh-domain-monitor.h" #include "virsh-util.h" #include "virsh.h" #include "virstring.h" @@ -299,17 +300,19 @@ virshDomainShutdownModeCompleter(vshControl *ctl, char ** -virshDomainInterfaceAddrSourceCompleter(vshControl *ctl, - const vshCmd *cmd, +virshDomainInterfaceAddrSourceCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, unsigned int flags) { - const char *sources[] = {"lease", "agent", "arp", NULL}; - const char *source = NULL; + char **ret = NULL; + size_t i; virCheckFlags(0, NULL); - if (vshCommandOptStringQuiet(ctl, cmd, "source", &source) < 0) - return NULL; + ret = g_new0(typeof(*ret), VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST + 1); - return virshCommaStringListComplete(source, sources); + for (i = 0; i < VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST; i++) + ret[i] = g_strdup(virshDomainInterfaceAddressesSourceTypeToString(i)); + + return ret; } diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index de4abbaee7..97301f71f9 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2358,7 +2358,6 @@ static const vshCmdOptDef opts_domifaddr[] = { {.name = NULL} }; -VIR_ENUM_DECL(virshDomainInterfaceAddressesSource); VIR_ENUM_IMPL(virshDomainInterfaceAddressesSource, VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST, "lease", diff --git a/tools/virsh-domain-monitor.h b/tools/virsh-domain-monitor.h index 11a9156ae2..0de47c50c4 100644 --- a/tools/virsh-domain-monitor.h +++ b/tools/virsh-domain-monitor.h @@ -26,4 +26,6 @@ char *virshGetDomainDescription(vshControl *ctl, virDomainPtr dom, bool title, unsigned int flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; +VIR_ENUM_DECL(virshDomainInterfaceAddressesSource); + extern const vshCmdDef domMonitoringCmds[]; diff --git a/tools/virsh.h b/tools/virsh.h index d84659124a..903a2e53b6 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -31,6 +31,7 @@ #include "virpolkit.h" #include "vsh.h" #include "virsh-completer.h" +#include "virenum.h" #define VIRSH_PROMPT_RW "virsh # " #define VIRSH_PROMPT_RO "virsh > "