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 // if the volume is read-only, no resize should be done
// creating bigger size clone from a volume, we need to check filesystem if !volOptions.readOnly {
// resize is required, if required resize filesystem. // As we are supporting the restore of a volume to a bigger size and
// in case of encrypted block PVC resize only the LUKS device. // creating bigger size clone from a volume, we need to check filesystem
err = resizeNodeStagePath(ctx, isBlock, transaction, req.GetVolumeId(), stagingTargetPath) // resize is required, if required resize filesystem.
if err != nil { // in case of encrypted block PVC resize only the LUKS device.
return transaction, err err = resizeNodeStagePath(ctx, isBlock, transaction, req.GetVolumeId(), stagingTargetPath)
if err != nil {
return transaction, err
}
} }
return transaction, err return transaction, err