rbd: do not resize read-only volumes while staging

Volumes that were requested with a read-only capability should not be
resized.

Reported-by: Alex Kalenyuk <akalenyu@redhat.com>
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2025-04-24 17:15:02 +02:00 committed by mergify[bot]
parent ea7be34396
commit 31da09863e

View File

@ -474,13 +474,16 @@ func (ns *NodeServer) stageTransaction(
}
}
// As we are supporting the restore of a volume to a bigger size and
// creating bigger size clone from a volume, we need to check filesystem
// resize is required, if required resize filesystem.
// in case of encrypted block PVC resize only the LUKS device.
err = resizeNodeStagePath(ctx, isBlock, transaction, req.GetVolumeId(), stagingTargetPath)
if err != nil {
return transaction, err
// if the volume is read-only, no resize should be done
if !volOptions.readOnly {
// As we are supporting the restore of a volume to a bigger size and
// creating bigger size clone from a volume, we need to check filesystem
// resize is required, if required resize filesystem.
// in case of encrypted block PVC resize only the LUKS device.
err = resizeNodeStagePath(ctx, isBlock, transaction, req.GetVolumeId(), stagingTargetPath)
if err != nil {
return transaction, err
}
}
return transaction, err