From: Peter Krempa Date: Wed, 13 Dec 2023 15:55:59 +0000 (+0100) Subject: qemuDomainBlockResize: Agregate all checks at the beginning X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=59ec4c66194cf481906d51a9d0551dc76c10e95e;p=libvirt.git qemuDomainBlockResize: Agregate all checks at the beginning Move the check for readonly and empty disks to the top where all other checks will be done. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4a21e5af9c..7f719c33de 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9279,6 +9279,13 @@ qemuDomainBlockResize(virDomainPtr dom, goto endjob; } + if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("can't resize empty or readonly disk '%1$s'"), + disk->dst); + goto endjob; + } + if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("block resize is not supported for vhostuser disk")); @@ -9292,13 +9299,6 @@ qemuDomainBlockResize(virDomainPtr dom, disk->src->format == VIR_STORAGE_FILE_QED) size = VIR_ROUND_UP(size, 512); - if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("can't resize empty or readonly disk '%1$s'"), - disk->dst); - goto endjob; - } - if (!qemuDiskBusIsSD(disk->bus)) { nodename = qemuBlockStorageSourceGetEffectiveNodename(disk->src); } else {