qemuDomainBlockResize() issues block_resize via QMP, which updates the qcow2 header on disk and bs->total_sectors in qemu, but the cached disk->src->capacity in libvirt is left at its pre-resize value.
All current readers re-read capacity from either QMP or the file itself before returning to the user, so the staleness is not externally observable today. Still, the cached field should reflect what we just asked qemu to write; keeping the two in sync avoids surprises for any future consumer that trusts the cached value. Signed-off-by: Denis V. Lunev <[email protected]> CC: Peter Krempa <[email protected]> CC: Michal Privoznik <[email protected]> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2d31d4aa31..a419c5cc95 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9598,6 +9598,9 @@ qemuDomainBlockResize(virDomainPtr dom, } qemuDomainObjExitMonitor(vm); + /* Keep the cached capacity in sync with qemu representation. */ + disk->src->capacity = size; + if (persistDisk) { g_clear_pointer(&persistDisk->src->sliceStorage, virStorageSourceSliceFree); qemuDomainSaveConfig(vm); -- 2.51.0
