From b40d561228d0b742224f62531492c4b3b73e897e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 30 Nov 2020 15:00:01 +0530 Subject: [PATCH] cephfs: make getVolumeRootPathCeph as a method getVolumeRootPathCeph is a method of volumeOptions Signed-off-by: Madhu Rajanna --- internal/cephfs/fsjournal.go | 2 +- internal/cephfs/volume.go | 6 +++--- internal/cephfs/volumeoptions.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/cephfs/fsjournal.go b/internal/cephfs/fsjournal.go index 4fd948e6d..9e3280d2a 100644 --- a/internal/cephfs/fsjournal.go +++ b/internal/cephfs/fsjournal.go @@ -132,7 +132,7 @@ func checkVolExists(ctx context.Context, return nil, fmt.Errorf("clone is not in complete state for %s", vid.FsSubvolName) } } else { - _, err = getVolumeRootPathCeph(ctx, volOptions, volumeID(vid.FsSubvolName)) + _, err = volOptions.getVolumeRootPathCeph(ctx, volumeID(vid.FsSubvolName)) if err != nil { if errors.Is(err, ErrVolumeNotFound) { err = j.UndoReservation(ctx, volOptions.MetadataPool, diff --git a/internal/cephfs/volume.go b/internal/cephfs/volume.go index d6f7baca3..b63054468 100644 --- a/internal/cephfs/volume.go +++ b/internal/cephfs/volume.go @@ -56,13 +56,13 @@ func getVolumeRootPathCephDeprecated(volID volumeID) string { return path.Join("/", "csi-volumes", string(volID)) } -func getVolumeRootPathCeph(ctx context.Context, volOptions *volumeOptions, volID volumeID) (string, error) { - fsa, err := volOptions.conn.GetFSAdmin() +func (vo *volumeOptions) getVolumeRootPathCeph(ctx context.Context, volID volumeID) (string, error) { + fsa, err := vo.conn.GetFSAdmin() if err != nil { util.ErrorLog(ctx, "could not get FSAdmin err %s", err) return "", err } - svPath, err := fsa.SubVolumePath(volOptions.FsName, volOptions.SubvolumeGroup, string(volID)) + svPath, err := fsa.SubVolumePath(vo.FsName, vo.SubvolumeGroup, string(volID)) if err != nil { util.ErrorLog(ctx, "failed to get the rootpath for the vol %s: %s", string(volID), err) if strings.Contains(err.Error(), volumeNotFound) { diff --git a/internal/cephfs/volumeoptions.go b/internal/cephfs/volumeoptions.go index 4eb081dca..6f9db0a8c 100644 --- a/internal/cephfs/volumeoptions.go +++ b/internal/cephfs/volumeoptions.go @@ -347,7 +347,7 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret } if errors.Is(err, ErrInvalidCommand) { - volOptions.RootPath, err = getVolumeRootPathCeph(ctx, &volOptions, volumeID(vid.FsSubvolName)) + volOptions.RootPath, err = volOptions.getVolumeRootPathCeph(ctx, volumeID(vid.FsSubvolName)) } return &volOptions, &vid, err