mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
virsh: Add a completer for domifaddr
--source parameter.
The command `domifaddr` can use three different sources to grab IP address of a Virtual Machine: lease, agent and arp. This parameter does not have a completer function to return source options. Signed-off-by: Julio Faracco <jcfaracco@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
db5d049911
commit
cf44ec5577
@ -296,3 +296,20 @@ virshDomainShutdownModeCompleter(vshControl *ctl,
|
||||
|
||||
return virshCommaStringListComplete(mode, modes);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshDomainInterfaceAddrSourceCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags)
|
||||
{
|
||||
const char *sources[] = {"lease", "agent", "arp", NULL};
|
||||
const char *source = NULL;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
if (vshCommandOptStringQuiet(ctl, cmd, "source", &source) < 0)
|
||||
return NULL;
|
||||
|
||||
return virshCommaStringListComplete(source, sources);
|
||||
}
|
||||
|
@ -53,3 +53,8 @@ char ** virshDomainDeviceAliasCompleter(vshControl *ctl,
|
||||
char ** virshDomainShutdownModeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **
|
||||
virshDomainInterfaceAddrSourceCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -2346,6 +2346,7 @@ static const vshCmdOptDef opts_domifaddr[] = {
|
||||
{.name = "source",
|
||||
.type = VSH_OT_STRING,
|
||||
.flags = VSH_OFLAG_NONE,
|
||||
.completer = virshDomainInterfaceAddrSourceCompleter,
|
||||
.help = N_("address source: 'lease', 'agent', or 'arp'")},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user