cephfs: remove unused cr Credentials

removed unused cr variable.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-12-09 12:25:37 +05:30 committed by mergify[bot]
parent 9a96370942
commit 0d9fcbc21b
4 changed files with 12 additions and 13 deletions

View File

@ -43,7 +43,7 @@ const (
snapshotIsProtected = "yes"
)
func createCloneFromSubvolume(ctx context.Context, volID, cloneID volumeID, volOpt, parentvolOpt *volumeOptions, cr *util.Credentials) error {
func createCloneFromSubvolume(ctx context.Context, volID, cloneID volumeID, volOpt, parentvolOpt *volumeOptions) error {
snapshotID := cloneID
err := parentvolOpt.createSnapshot(ctx, snapshotID, volID)
if err != nil {
@ -65,7 +65,7 @@ func createCloneFromSubvolume(ctx context.Context, volID, cloneID volumeID, volO
}
if cloneErr != nil {
if err = volOpt.purgeVolume(ctx, cloneID, cr, true); err != nil {
if err = volOpt.purgeVolume(ctx, cloneID, true); err != nil {
util.ErrorLog(ctx, "failed to delete volume %s: %v", cloneID, err)
}
if err = parentvolOpt.unprotectSnapshot(ctx, snapshotID, volID); err != nil {
@ -167,7 +167,7 @@ func isCloneRetryError(err error) bool {
return errors.Is(err, ErrCloneInProgress) || errors.Is(err, ErrClonePending)
}
func createCloneFromSnapshot(ctx context.Context, parentVolOpt, volOptions *volumeOptions, vID *volumeIdentifier, sID *snapshotIdentifier, cr *util.Credentials) error {
func createCloneFromSnapshot(ctx context.Context, parentVolOpt, volOptions *volumeOptions, vID *volumeIdentifier, sID *snapshotIdentifier) error {
snapID := volumeID(sID.FsSnapshotName)
err := parentVolOpt.cloneSnapshot(ctx, volumeID(sID.FsSubvolName), snapID, volumeID(vID.FsSubvolName), volOptions)
if err != nil {
@ -176,7 +176,7 @@ func createCloneFromSnapshot(ctx context.Context, parentVolOpt, volOptions *volu
defer func() {
if err != nil {
if !isCloneRetryError(err) {
if dErr := volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, true); dErr != nil {
if dErr := volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), true); dErr != nil {
util.ErrorLog(ctx, "failed to delete volume %s: %v", vID.FsSubvolName, dErr)
}
}

View File

@ -55,8 +55,7 @@ func (cs *ControllerServer) createBackingVolume(
vID,
pvID *volumeIdentifier,
sID *snapshotIdentifier,
cr *util.Credentials) error {
sID *snapshotIdentifier) error {
var err error
if sID != nil {
if err = cs.OperationLocks.GetRestoreLock(sID.SnapshotID); err != nil {
@ -65,7 +64,7 @@ func (cs *ControllerServer) createBackingVolume(
}
defer cs.OperationLocks.ReleaseRestoreLock(sID.SnapshotID)
err = createCloneFromSnapshot(ctx, parentVolOpt, volOptions, vID, sID, cr)
err = createCloneFromSnapshot(ctx, parentVolOpt, volOptions, vID, sID)
if err != nil {
util.ErrorLog(ctx, "failed to create clone from snapshot %s: %v", sID.FsSnapshotName, err)
return err
@ -78,7 +77,7 @@ func (cs *ControllerServer) createBackingVolume(
return status.Error(codes.Aborted, err.Error())
}
defer cs.OperationLocks.ReleaseCloneLock(pvID.VolumeID)
err = createCloneFromSubvolume(ctx, volumeID(pvID.FsSubvolName), volumeID(vID.FsSubvolName), volOptions, parentVolOpt, cr)
err = createCloneFromSubvolume(ctx, volumeID(pvID.FsSubvolName), volumeID(vID.FsSubvolName), volOptions, parentVolOpt)
if err != nil {
util.ErrorLog(ctx, "failed to create clone from subvolume %s: %v", volumeID(pvID.FsSubvolName), err)
return err
@ -188,7 +187,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
// explicitly
err = volOptions.resizeVolume(ctx, volumeID(vID.FsSubvolName), volOptions.Size)
if err != nil {
purgeErr := volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, false)
purgeErr := volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), false)
if purgeErr != nil {
util.ErrorLog(ctx, "failed to delete volume %s: %v", requestName, purgeErr)
// All errors other than ErrVolumeNotFound should return an error back to the caller
@ -244,7 +243,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
}()
// Create a volume
err = cs.createBackingVolume(ctx, volOptions, parentVol, vID, pvID, sID, cr)
err = cs.createBackingVolume(ctx, volOptions, parentVol, vID, pvID, sID)
if err != nil {
if isCloneRetryError(err) {
return nil, status.Error(codes.Aborted, err.Error())
@ -349,7 +348,7 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
}
defer cr.DeleteCredentials()
if err = volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, false); err != nil {
if err = volOptions.purgeVolume(ctx, volumeID(vID.FsSubvolName), false); err != nil {
util.ErrorLog(ctx, "failed to delete volume %s: %v", volID, err)
if errors.Is(err, ErrVolumeHasSnapshots) {
return nil, status.Error(codes.FailedPrecondition, err.Error())

View File

@ -108,7 +108,7 @@ func checkVolExists(ctx context.Context,
return nil, ErrClonePending
}
if cloneState == cephFSCloneFailed {
err = volOptions.purgeVolume(ctx, volumeID(vid.FsSubvolName), cr, true)
err = volOptions.purgeVolume(ctx, volumeID(vid.FsSubvolName), true)
if err != nil {
util.ErrorLog(ctx, "failed to delete volume %s: %v", vid.FsSubvolName, err)
return nil, err

View File

@ -209,7 +209,7 @@ func (vo *volumeOptions) resizeVolume(ctx context.Context, volID volumeID, bytes
return createVolume(ctx, vo, volID, bytesQuota)
}
func (vo *volumeOptions) purgeVolume(ctx context.Context, volID volumeID, cr *util.Credentials, force bool) error {
func (vo *volumeOptions) purgeVolume(ctx context.Context, volID volumeID, force bool) error {
fsa, err := vo.conn.GetFSAdmin()
if err != nil {
util.ErrorLog(ctx, "could not get FSAdmin %s:", err)