[libvirt] [PATCH 5/5] virsh: Introduce --best-effort to domstats

John Ferlan jferlan at redhat.com
Wed Jun 13 15:34:41 UTC 2018



On 06/07/2018 07:59 AM, Michal Privoznik wrote:
> This new switch can be used to set
> VIR_CONNECT_GET_ALL_DOMAINS_STATS_BEST_EFFORT flag for stats
> fetching API.

I'll reiterate my preference for nowait

> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tools/virsh-domain-monitor.c |  7 +++++++
>  tools/virsh.pod              | 16 +++++++++++-----
>  2 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 8cbb3db37c..96a65a8ac7 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -1992,6 +1992,10 @@ static const vshCmdOptDef opts_domstats[] = {
>       .type = VSH_OT_BOOL,
>       .help = N_("add backing chain information to block stats"),
>      },
> +    {.name = "best-effort",
> +     .type = VSH_OT_BOOL,
> +     .help = N_("ignore stalled domains"),
> +    },
>      VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("list of domains to get stats for"), 0),
>      {.name = NULL}
>  };
> @@ -2087,6 +2091,9 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
>      if (vshCommandOptBool(cmd, "backing"))
>          flags |= VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING;
>  
> +    if (vshCommandOptBool(cmd, "best-effort"))
> +        flags |= VIR_CONNECT_GET_ALL_DOMAINS_STATS_BEST_EFFORT;
> +
>      if (vshCommandOptBool(cmd, "domain")) {
>          if (VIR_ALLOC_N(domlist, 1) < 0)
>              goto cleanup;
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index 3f3314a87e..8f3bc67405 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -968,11 +968,11 @@ that require a block device name (such as I<domblkinfo> or
>  I<snapshot-create> for disk snapshots) will accept either target
>  or unique source names printed by this command.
>  
> -=item B<domstats> [I<--raw>] [I<--enforce>] [I<--backing>] [I<--state>]
> -[I<--cpu-total>] [I<--balloon>] [I<--vcpu>] [I<--interface>] [I<--block>]
> -[I<--perf>] [[I<--list-active>] [I<--list-inactive>] [I<--list-persistent>]
> -[I<--list-transient>] [I<--list-running>] [I<--list-paused>]
> -[I<--list-shutoff>] [I<--list-other>]] | [I<domain> ...]
> +=item B<domstats> [I<--raw>] [I<--enforce>] [I<--backing>] [I<--best-effort>]
> +[I<--state>] [I<--cpu-total>] [I<--balloon>] [I<--vcpu>] [I<--interface>]
> +[I<--block>] [I<--perf>] [[I<--list-active>] [I<--list-inactive>]
> +[I<--list-persistent>] [I<--list-transient>] [I<--list-running>]
> +[I<--list-paused>] [I<--list-shutoff>] [I<--list-other>]] | [I<domain> ...]
>  
>  Get statistics for multiple or all domains. Without any argument this
>  command prints all available statistics for all domains.
> @@ -1123,6 +1123,12 @@ daemon supports the selected group of stats. Flag I<--enforce>
>  forces the command to fail if the daemon doesn't support the
>  selected group.
>  
> +When collecting stats libvirtd may wait for some time if there's
> +already another job running on given domain for it to finish.
> +This may cause unnecessary delay in delivering stats. Using
> +I<--best-effort> suppresses this behaviour. On the other hand
> +some statistics might be missing for such domain.
> +

By supplying the --nowait qualifier, this tells libvirt to avoid
collecting detailed statistics from domains that are actively running
some other job. In this case, it is possible that the returned
statistics for those domains only includes a minimal set of statistics
that does not require querying the domain hypervisor.

John


>  =item B<domiflist> I<domain> [I<--inactive>]
>  
>  Print a table showing the brief information of all virtual interfaces
> 




More information about the libvir-list mailing list