From 4face6a7b37261d4ef8f97c7e20d2610890d8abf Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 7 Sep 2022 11:50:45 +0530 Subject: [PATCH] cephfs: retry subvolumegroup creation Incase the subvolumegroup is deleted and recreated we need to restart the cephcsi provisioner pod to clear cache that cephcsi maintains. With this PR if cephcsi sees NotFound error duing subvolume creation it will reset the cache for that filesystem so that in next RPC call cephcsi will try to create the subvolumegroup again Ref: https://github.com/rook/rook/issues/10623 Signed-off-by: Madhu Rajanna (cherry picked from commit 76064d8e34eb40bc9a4f66fd65021052cdaccb35) --- internal/cephfs/core/volume.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/cephfs/core/volume.go b/internal/cephfs/core/volume.go index ee0611c9e..ff71baf41 100644 --- a/internal/cephfs/core/volume.go +++ b/internal/cephfs/core/volume.go @@ -259,6 +259,12 @@ func (s *subVolumeClient) CreateVolume(ctx context.Context) error { if err != nil { log.ErrorLog(ctx, "failed to create subvolume %s in fs %s: %s", s.VolID, s.FsName, err) + if errors.Is(err, rados.ErrNotFound) { + // Reset the subVolumeGroupsCreated so that we can try again to create the + // subvolumegroup in next request if the error is Not Found. + clusterAdditionalInfo[s.clusterID].subVolumeGroupsCreated[s.FsName] = false + } + return err }