Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d8a202fa47..d0a680629e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20208,20 +20208,18 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, { char *alias = NULL; - virStorageSourcePtr src = disk->src; + virStorageSourcePtr n; int ret = -1; - while (virStorageSourceIsBacking(src) && - (src == disk->src || visitBacking)) { - + for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { /* alias may be NULL if the VM is not running */ if (disk->info.alias && - !(alias = qemuDomainStorageAlias(disk->info.alias, src->id))) + !(alias = qemuDomainStorageAlias(disk->info.alias, n->id))) goto cleanup; - qemuDomainGetStatsOneBlockRefreshNamed(src, alias, stats, nodestats); + qemuDomainGetStatsOneBlockRefreshNamed(n, alias, stats, nodestats); - if (qemuDomainGetStatsBlockExportHeader(disk, src, *recordnr, + if (qemuDomainGetStatsBlockExportHeader(disk, n, *recordnr, records, nrecords) < 0) goto cleanup; @@ -20230,13 +20228,15 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, goto cleanup; if (qemuDomainGetStatsOneBlock(driver, cfg, dom, records, nrecords, - alias, src, *recordnr, + alias, n, *recordnr, stats) < 0) goto cleanup; VIR_FREE(alias); (*recordnr)++; - src = src->backingStore; + + if (!visitBacking) + break; } ret = 0; -- 2.16.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list