1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-12-13 16:55:59 +01:00
parent b600b69f82
commit 59ec4c6619

View File

@ -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 {