diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 87123d1184..cb76d8ce58 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10910,6 +10910,9 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * "block..name" - name of the block device as string. * matches the target name (vda/sda/hda) of the * block device. + * "block..path" - string describing the source of block device , + * if it is a file or block device (omitted for network + * sources and drives with no media inserted). * "block..rd.reqs" - number of read requests as unsigned long long. * "block..rd.bytes" - number of read bytes as unsigned long long. * "block..rd.times" - total time (ns) spent on reads as diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d87ea98fd9..dc62a75df7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18374,11 +18374,11 @@ do { \ goto cleanup; \ } while (0) -#define QEMU_ADD_NAME_PARAM(record, maxparams, type, num, name) \ +#define QEMU_ADD_NAME_PARAM(record, maxparams, type, subtype, num, name) \ do { \ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \ snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \ - "%s.%zu.name", type, num); \ + "%s.%zu.%s", type, num, subtype); \ if (virTypedParamsAddString(&(record)->params, \ &(record)->nparams, \ maxparams, \ @@ -18424,7 +18424,7 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, memset(&tmp, 0, sizeof(tmp)); QEMU_ADD_NAME_PARAM(record, maxparams, - "net", i, dom->def->nets[i]->ifname); + "net", "name", i, dom->def->nets[i]->ifname); if (virNetInterfaceStats(dom->def->nets[i]->ifname, &tmp) < 0) { virResetLastError(); @@ -18517,7 +18517,10 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver, qemuBlockStats *entry; virDomainDiskDefPtr disk = dom->def->disks[i]; - QEMU_ADD_NAME_PARAM(record, maxparams, "block", i, disk->dst); + QEMU_ADD_NAME_PARAM(record, maxparams, "block", "name", i, disk->dst); + if (virStorageSourceIsLocalStorage(disk->src) && disk->src->path) + QEMU_ADD_NAME_PARAM(record, maxparams, "block", "path", + i, disk->src->path); if (abbreviated || !disk->info.alias || !(entry = virHashLookup(stats, disk->info.alias))) { diff --git a/tools/virsh.pod b/tools/virsh.pod index c070261d79..cbd822754d 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -883,6 +883,8 @@ I<--interface> returns: I<--block> returns: "block.count" - number of block devices on this domain, "block..name" - name of the target of the block device , +"block..path" - file source of block device , if it is a +local file or block device, "block..rd.reqs" - number of read requests, "block..rd.bytes" - number of read bytes, "block..rd.times" - total time (ns) spent on reads,