[libvirt] [PATCH 2/6] lxc: Introduce method lxcDomainGetStats().
Peter Krempa
pkrempa at redhat.com
Tue Mar 12 11:55:06 UTC 2019
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 at gmail.com>
> ---
> 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190312/06cd65f4/attachment-0001.sig>
More information about the libvir-list
mailing list