mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
cephfs: make getVolumeRootPathCeph as a method
getVolumeRootPathCeph is a method of volumeOptions Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
e4713bc9ed
commit
b40d561228
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user