From: Peter Krempa <[email protected]> Use 'qemuDomainStorageSourceProbeSize' instead of 'qemuDomainStorageUpdatePhysical'.
Since 'size_src' was used just to fetch the 'physical' field, the patch localizes the scope of the pointer and uses the 'physical' value instead. Signed-off-by: Peter Krempa <[email protected]> --- src/qemu/qemu_driver.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 253727129c..1b14c6d42e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9547,7 +9547,7 @@ qemuDomainBlockResize(virDomainPtr dom, const char *nodename = NULL; virDomainDiskDef *disk = NULL; virDomainDiskDef *persistDisk = NULL; - virStorageSource *size_src = NULL; + unsigned long long physical = 0; virCheckFlags(VIR_DOMAIN_BLOCK_RESIZE_BYTES | VIR_DOMAIN_BLOCK_RESIZE_CAPACITY | @@ -9606,6 +9606,7 @@ qemuDomainBlockResize(virDomainPtr dom, */ if ((flags & VIR_DOMAIN_BLOCK_RESIZE_CAPACITY) || disk->src->sliceStorage) { g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(priv->driver); + virStorageSource *size_src = NULL; if (disk->src->dataFileStore) size_src = disk->src->dataFileStore; @@ -9622,7 +9623,7 @@ qemuDomainBlockResize(virDomainPtr dom, } if (virStorageSourceIsBlockLocal(size_src)) { - if (qemuDomainStorageUpdatePhysical(cfg, vm, size_src) < 0) { + if (qemuDomainStorageSourceProbeSize(cfg, vm, size_src, NULL, NULL, &physical) < 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("failed to update capacity of '%1$s'"), size_src->path); goto endjob; @@ -9632,11 +9633,11 @@ qemuDomainBlockResize(virDomainPtr dom, if (flags & VIR_DOMAIN_BLOCK_RESIZE_CAPACITY) { if (size == 0) { - size = size_src->physical; - } else if (size != size_src->physical) { + size = physical; + } else if (size != physical) { virReportError(VIR_ERR_INVALID_ARG, _("Requested resize to '%1$llu' but device size is '%2$llu'"), - size, size_src->physical); + size, physical); goto endjob; } } @@ -9676,10 +9677,10 @@ qemuDomainBlockResize(virDomainPtr dom, /* trying to resize a block device to a size not equal to the actual * size of the block device will cause qemu to fail */ if (virStorageSourceIsBlockLocal(disk->src) && - disk->src->physical != size) { + physical != size) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("block device backed disk must be resized to its actual size '%1$llu'"), - disk->src->physical); + physical); goto endjob; } -- 2.54.0
