[PATCH 0/4] qemu: Fix multiple issues in block information gathering
virDomainGetBlockInfo didn't log arguments and updates of disk state qemuDomainGetStatsBlockExportDisk didn't export information about <dataStore> in the bulk stats. Peter Krempa (4): virDomainGetBlockInfo: Log 'disk' argument qemuDomainGetStatsBlockExportDisk: Export stats also for 'dataStore' qemu: monitor: Separate stats from capacity properties in qemuBlockStats qemuDomainGetBlockInfo: Add debug statement when updating disk physical size src/libvirt-domain.c | 9 ++++++--- src/qemu/qemu_driver.c | 15 +++++++++++++++ src/qemu/qemu_monitor.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) -- 2.53.0
From: Peter Krempa <pkrempa@redhat.com> The 'disk' argument was forgotten in the VIR_DOMAIN_DEBUG statement so the logs don't contain which disk the caller wanted the stats for. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/libvirt-domain.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 6b8783d57f..cc19a214ce 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -6681,12 +6681,15 @@ virDomainMemoryPeek(virDomainPtr dom, * Since: 0.8.1 */ int -virDomainGetBlockInfo(virDomainPtr domain, const char *disk, - virDomainBlockInfoPtr info, unsigned int flags) +virDomainGetBlockInfo(virDomainPtr domain, + const char *disk, + virDomainBlockInfoPtr info, + unsigned int flags) { virConnectPtr conn; - VIR_DOMAIN_DEBUG(domain, "info=%p, flags=0x%x", info, flags); + VIR_DOMAIN_DEBUG(domain, "disk='%s', info=%p, flags=0x%x", + disk, info, flags); virResetLastError(); -- 2.53.0
From: Peter Krempa <pkrempa@redhat.com> For qcow2 disk images backed by another storage for storing the actual blocks (the 'data-file' feature) we forgot to export stats in the bulk stats API. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_driver.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6fa6170b6f..d92269d3b6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17906,6 +17906,20 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef *disk, if (!visitBacking) break; + + if (virStorageSourceIsBacking(n->dataFileStore)) { + qemuDomainGetStatsBlockExportHeader(disk, n->dataFileStore, + *recordnr, params); + + qemuDomainGetStatsOneBlock(cfg, dom, params, + qemuBlockStorageSourceGetEffectiveNodename(n->dataFileStore), + n->dataFileStore, + *recordnr, stats); + + qemuDomainGetStatsBlockExportBackendStorage(qemuBlockStorageSourceGetStorageNodename(n->dataFileStore), + stats, *recordnr, params); + (*recordnr)++; + } } /* in blockdev mode where we can properly and uniquely identify images we -- 2.53.0
From: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_monitor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d3611d9713..34a345942f 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -851,6 +851,7 @@ struct _qemuBlockStats { unsigned long long wr_total_times; unsigned long long flush_req; unsigned long long flush_total_times; + unsigned long long capacity; unsigned long long physical; -- 2.53.0
From: Peter Krempa <pkrempa@redhat.com> Update of the physical size fetches it from stat()-ing the file on disk, which is not visible in the logs so the information can't be pieced back together as it's the case with the data fetched from the qemu monitor. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d92269d3b6..f4805a93ca 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10664,6 +10664,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, info->allocation = entry->physical; if (qemuDomainStorageUpdatePhysical(cfg, vm, disk->src) == 0) { + VIR_DEBUG("updating physical disk size to '%llu'", disk->src->physical); info->physical = disk->src->physical; } else { info->physical = entry->physical; -- 2.53.0
On a Tuesday in 2026, Peter Krempa via Devel wrote:
virDomainGetBlockInfo didn't log arguments and updates of disk state
qemuDomainGetStatsBlockExportDisk didn't export information about <dataStore> in the bulk stats.
Peter Krempa (4): virDomainGetBlockInfo: Log 'disk' argument qemuDomainGetStatsBlockExportDisk: Export stats also for 'dataStore' qemu: monitor: Separate stats from capacity properties in qemuBlockStats qemuDomainGetBlockInfo: Add debug statement when updating disk physical size
src/libvirt-domain.c | 9 ++++++--- src/qemu/qemu_driver.c | 15 +++++++++++++++ src/qemu/qemu_monitor.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko -
Peter Krempa