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:
Julio Faracco
2020-01-02 12:07:06 -03:00
committed by Erik Skultety
parent db5d049911
commit cf44ec5577
3 changed files with 23 additions and 0 deletions

View File

@@ -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);
}