Skip to content

Commit

Permalink
cleanup: removed unused SnapshotInfo from CheckSnapExists()
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen M <[email protected]>
  • Loading branch information
iPraveenParihar authored and nixpanic committed Oct 31, 2023
1 parent 1762ff3 commit b2432e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/cephfs/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func (cs *ControllerServer) CreateSnapshot(
}
defer cs.VolumeLocks.Release(sourceVolID)
snapName := req.GetName()
sid, _, err := store.CheckSnapExists(ctx, parentVolOptions, cephfsSnap, cs.ClusterName, cs.SetMetadata, cr)
sid, err := store.CheckSnapExists(ctx, parentVolOptions, cephfsSnap, cs.ClusterName, cs.SetMetadata, cr)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
16 changes: 8 additions & 8 deletions internal/cephfs/store/fsjournal.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ func CheckSnapExists(
clusterName string,
setMetadata bool,
cr *util.Credentials,
) (*SnapshotIdentifier, *core.SnapshotInfo, error) {
) (*SnapshotIdentifier, error) {
// Connect to cephfs' default radosNamespace (csi)
j, err := SnapJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
if err != nil {
return nil, nil, err
return nil, err
}
defer j.Destroy()

Expand All @@ -411,10 +411,10 @@ func CheckSnapExists(
snapData, err := j.CheckReservation(
ctx, volOptions.MetadataPool, snap.RequestName, snap.NamePrefix, volOptions.VolID, kmsID, encryptionType)
if err != nil {
return nil, nil, err
return nil, err
}
if snapData == nil {
return nil, nil, nil
return nil, nil
}
sid := &SnapshotIdentifier{}
snapUUID := snapData.ImageUUID
Expand All @@ -428,10 +428,10 @@ func CheckSnapExists(
err = j.UndoReservation(ctx, volOptions.MetadataPool,
volOptions.MetadataPool, snapID, snap.RequestName)

return nil, nil, err
return nil, err
}

return nil, nil, err
return nil, err
}

defer func() {
Expand All @@ -455,10 +455,10 @@ func CheckSnapExists(
sid.SnapshotID, err = util.GenerateVolID(ctx, volOptions.Monitors, cr, volOptions.FscID,
"", volOptions.ClusterID, snapUUID, fsutil.VolIDVersion)
if err != nil {
return nil, nil, err
return nil, err
}
log.DebugLog(ctx, "Found existing snapshot (%s) with subvolume name (%s) for request (%s)",
snapData.ImageAttributes.RequestName, volOptions.VolID, sid.FsSnapshotName)

return sid, &snapInfo, nil
return sid, nil
}

0 comments on commit b2432e8

Please sign in to comment.