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 <jcfara...@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; + + 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@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list