On 01/15/2014 07:23 AM, Thorsten Behrens wrote: > And provide domain summary stats in that case, for lxc backend. > Use case is a container domain using passthrough bind mounts of the > host filesystem, which is a common case for lxc. > --- > src/libvirt.c | 1 - > src/lxc/lxc_driver.c | 10 ++++++++++ > src/qemu/qemu_driver.c | 2 ++ > src/remote/remote_driver.c | 2 ++ > src/test/test_driver.c | 2 ++ > src/xen/xen_driver.c | 2 ++ > 6 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/src/libvirt.c b/src/libvirt.c > index 87a4d46..14ffca0 100644 > --- a/src/libvirt.c > +++ b/src/libvirt.c > @@ -7804,7 +7804,6 @@ virDomainBlockStats(virDomainPtr dom, const char *disk, > virResetLastError(); > > virCheckDomainReturn(dom, -1); > - virCheckNonNullArgGoto(disk, error); > virCheckNonNullArgGoto(stats, error); > if (size > sizeof(stats2)) { > virReportInvalidArg(size, > diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c > index 1d2a457..fba9c12 100644 > --- a/src/lxc/lxc_driver.c > +++ b/src/lxc/lxc_driver.c > @@ -2044,6 +2044,16 @@ lxcDomainBlockStats(virDomainPtr dom, > goto cleanup; > } > > + if (!path || !*path) { > + /* empty/NULL path - return entire domain blkstats instead */ > + ret = virCgroupGetBlkioIoServiced(priv->cgroup, > + &stats->rd_bytes, > + &stats->wr_bytes, > + &stats->rd_req, > + &stats->wr_req); > + goto cleanup; > + } > + I'm ok with this one, Let's see if others will object. but you should check if we can use the NEW API as I mehtioned in prev thread, and change the manpage of virsh domblkstat. > if ((idx = virDomainDiskIndexByName(vm->def, path, false)) < 0) { > virReportError(VIR_ERR_INVALID_ARG, > _("invalid path: %s"), path); > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 2d92873..4dcf12b 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -9021,6 +9021,8 @@ qemuDomainBlockStats(virDomainPtr dom, > virDomainDiskDefPtr disk = NULL; > qemuDomainObjPrivatePtr priv; > > + virCheckNonNullArgReturn(path, -1); > + > if (!(vm = qemuDomObjFromDomain(dom))) > goto cleanup; > > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c > index da9c1c9..160bdd4 100644 > --- a/src/remote/remote_driver.c > +++ b/src/remote/remote_driver.c > @@ -1713,6 +1713,8 @@ remoteDomainBlockStatsFlags(virDomainPtr domain, > remote_domain_block_stats_flags_ret ret; > struct private_data *priv = domain->conn->privateData; > > + virCheckNonNullArgReturn(path, -1); > + > remoteDriverLock(priv); > > make_nonnull_domain(&args.dom, domain); > diff --git a/src/test/test_driver.c b/src/test/test_driver.c > index b724f82..7c637bb 100644 > --- a/src/test/test_driver.c > +++ b/src/test/test_driver.c > @@ -3362,6 +3362,8 @@ static int testDomainBlockStats(virDomainPtr domain, > unsigned long long statbase; > int ret = -1; > > + virCheckNonNullArgReturn(path, -1); > + > testDriverLock(privconn); > privdom = virDomainObjListFindByName(privconn->domains, > domain->name); > diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c > index c45d10f..2b9ac21 100644 > --- a/src/xen/xen_driver.c > +++ b/src/xen/xen_driver.c > @@ -2217,6 +2217,8 @@ xenUnifiedDomainBlockStats(virDomainPtr dom, const char *path, > virDomainDefPtr def = NULL; > int ret = -1; > > + virCheckNonNullArgReturn(path, -1); > + > if (!(def = xenGetDomainDefForDom(dom))) > goto cleanup; > > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list