Re: [PATCH 2/6] lxc: Introduce method lxcDomainGetStats().

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

 



On Mon, Mar 11, 2019 at 17:56:14 -0300, Julio Faracco wrote:
> This method is responsible to fetch data like State, CPU, Disk and
> Balloon info (all single domain info) from each domain 'virDomainObjPtr'.
> 
> Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
> ---
>  src/lxc/lxc_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 1ab6179572..72639e0d7d 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -5277,6 +5277,48 @@ lxcDomainGetMetadata(virDomainPtr dom,
>      return ret;
>  }
>  
> +static virDomainStatsRecordPtr
> +lxcDomainGetStats(virConnectPtr conn,
> +                  virDomainObjPtr dom)
> +{
> +    virLXCDriverPtr driver = conn->privateData;
> +    virDomainStatsRecordPtr stat;
> +    int maxparams = 0;
> +
> +    if (VIR_ALLOC(stat) < 0)
> +        return NULL;
> +
> +    if (!(stat->dom = virGetDomain(conn, dom->def->name, dom->def->uuid, dom->def->id)))
> +        goto error;
> +
> +    if (virLXCDomainObjBeginJob(driver, dom, LXC_JOB_QUERY) < 0)
> +        goto error;
> +
> +    if (lxcDomainGetStatsState(dom, stat, &maxparams) < 0)
> +        goto endjob;

This does not select the distinct groups of stats according to the
'stats' variable passed to the caller of this.

Also as said in cover letter this will not compile.

> +
> +    if (lxcDomainGetStatsCpu(dom, stat, &maxparams) < 0)
> +        goto endjob;
> +
> +    if (lxcDomainGetBlockStats(dom, stat, &maxparams) < 0)
> +        goto endjob;
> +
> +    if (lxcDomainGetBalloonStats(dom, stat, &maxparams) < 0)
> +        goto endjob;
> +
> +    virLXCDomainObjEndJob(driver, dom);
> +    return stat;
> +
> + endjob:
> +    virLXCDomainObjEndJob(driver, dom);
> +
> + error:
> +    virTypedParamsFree(stat->params, stat->nparams);
> +    virObjectUnref(stat->dom);
> +    VIR_FREE(stat);
> +    return NULL;
> +}
> +
>  static int
>  lxcConnectGetAllDomainStats(virConnectPtr conn,
>                              virDomainPtr *doms,
> -- 
> 2.19.1
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
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