On 01/15/2014 07:23 AM, Thorsten Behrens wrote: > --- > src/lxc/lxc_driver.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c > index 1e9c77a..1d2a457 100644 > --- a/src/lxc/lxc_driver.c > +++ b/src/lxc/lxc_driver.c > @@ -2021,6 +2021,56 @@ lxcDomainGetSchedulerParameters(virDomainPtr domain, > > > static int > +lxcDomainBlockStats(virDomainPtr dom, > + const char *path, > + struct _virDomainBlockStats *stats) > +{ > + int ret = -1, idx; > + virDomainObjPtr vm; > + virDomainDiskDefPtr disk = NULL; > + virLXCDomainObjPrivatePtr priv; > + > + if (!(vm = lxcDomObjFromDomain(dom))) > + return ret; > + > + priv = vm->privateData; > + > + if (virDomainBlockStatsEnsureACL(dom->conn, vm->def) < 0) > + goto cleanup; > + > + if (!virDomainObjIsActive(vm)) { > + virReportError(VIR_ERR_OPERATION_INVALID, > + "%s", _("domain is not running")); > + goto cleanup; > + } > + > + if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) { > + virReportError(VIR_ERR_INVALID_ARG, > + _("invalid path: %s"), path); > + goto cleanup; > + } > + disk = vm->def->disks[idx]; > + > + if (!disk->info.alias) { > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("missing disk device alias name for %s"), disk->dst); > + goto cleanup; > + } > + > + ret = virCgroupGetBlkioIoDeviceServiced(priv->cgroup, > + disk->info.alias, > + &stats->rd_bytes, > + &stats->wr_bytes, > + &stats->rd_req, > + &stats->wr_req); > +cleanup: > + if (vm) > + virObjectUnlock(vm); > + return ret; > +} > + > + > +static int > lxcDomainSetBlkioParameters(virDomainPtr dom, > virTypedParameterPtr params, > int nparams, > @@ -4962,6 +5012,7 @@ static virDriver lxcDriver = { > .domainGetSchedulerParametersFlags = lxcDomainGetSchedulerParametersFlags, /* 0.9.2 */ > .domainSetSchedulerParameters = lxcDomainSetSchedulerParameters, /* 0.5.0 */ > .domainSetSchedulerParametersFlags = lxcDomainSetSchedulerParametersFlags, /* 0.9.2 */ > + .domainBlockStats = lxcDomainBlockStats, /* 0.4.1 */ Just one question. Can't we implement the new API domainBlockStatsFlags? -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list