Re: [PATCH] virsh: Add a completer for `domifaddr` --source parameter.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/2/20 4:07 PM, Julio Faracco wrote:
> 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@xxxxxxxxx>
> ---
>  tools/virsh-completer-domain.c | 17 +++++++++++++++++
>  tools/virsh-completer-domain.h |  5 +++++
>  tools/virsh-domain-monitor.c   |  1 +
>  3 files changed, 23 insertions(+)
> 
> diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
> index 0311ee50d0..c8709baa38 100644
> --- a/tools/virsh-completer-domain.c
> +++ b/tools/virsh-completer-domain.c
> @@ -296,3 +296,20 @@ virshDomainShutdownModeCompleter(vshControl *ctl,
>  
>      return virshCommaStringListComplete(mode, modes);
>  }
> +
> +
> +char **
> +virshDomainIfAddrSourceCompleter(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);

Actually, I don't think this is coorect. This helper completes a string
list separated by commas, for instance a shutdown mode where more than
one string (method) can be used:

  virsh shutdown --mode acpi,agent,signal

But this is not the case for domifaddr --source, is it? It accepts
exactly one string. I know Erik pushed this, so I will post a fix up
later. Stay tuned.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux