From 4ec5e0af4204a3c31c2d9223d1e7a6ac891a04b8 Mon Sep 17 00:00:00 2001 From: rakshith-r Date: Wed, 9 Aug 2023 16:46:45 +0530 Subject: [PATCH] cephfs: set Pool parameter to empty for Snapshot-backed volumes Set VolumeOptions.Pool parameter to empty for Snapshot-backed volumes. This Pool parameter is optional and only used as 'pool-layout' parameter during subvolume and subvolume clone create request in cephcsi and not used for Snapshot-backed volume at all. It is not saved anywhere for use in subsequent operations after create too. Therefore, We can set it to empty and not error out. Signed-off-by: rakshith-r --- internal/cephfs/store/volumeoptions.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cephfs/store/volumeoptions.go b/internal/cephfs/store/volumeoptions.go index 1f97b7329784..79d77d361584 100644 --- a/internal/cephfs/store/volumeoptions.go +++ b/internal/cephfs/store/volumeoptions.go @@ -542,9 +542,10 @@ func (vo *VolumeOptions) populateVolumeOptionsFromBackingSnapshot( return fmtBackingSnapshotOptionMismatch("clusterID", vo.ClusterID, parentBackingSnapVolOpts.ClusterID) } - if vo.Pool != "" { - return errors.New("cannot set pool for snapshot-backed volume") - } + // Pool parameters is optional and only used to set 'pool_layout' argument for + // subvolume and subvolume clone create commands. + // Setting this to empty since it is not used with Snapshot-backed volume. + vo.Pool = "" if vo.MetadataPool != parentBackingSnapVolOpts.MetadataPool { return fmtBackingSnapshotOptionMismatch("MetadataPool", vo.MetadataPool, parentBackingSnapVolOpts.MetadataPool)