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:
parent
b600b69f82
commit
59ec4c6619
@ -9279,6 +9279,13 @@ qemuDomainBlockResize(virDomainPtr dom,
|
|||||||
goto endjob;
|
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) {
|
if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("block resize is not supported for vhostuser disk"));
|
_("block resize is not supported for vhostuser disk"));
|
||||||
@ -9292,13 +9299,6 @@ qemuDomainBlockResize(virDomainPtr dom,
|
|||||||
disk->src->format == VIR_STORAGE_FILE_QED)
|
disk->src->format == VIR_STORAGE_FILE_QED)
|
||||||
size = VIR_ROUND_UP(size, 512);
|
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)) {
|
if (!qemuDiskBusIsSD(disk->bus)) {
|
||||||
nodename = qemuBlockStorageSourceGetEffectiveNodename(disk->src);
|
nodename = qemuBlockStorageSourceGetEffectiveNodename(disk->src);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user