mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-25 07:40:19 +00:00
cleanup: replace parentName to snapParentName in checkReservation
at present, eventhough the checkReservation works for both volume and snapshot, the arg parentName make sense only for snapshot cases renaming that arg to more approprite Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
1fee3ec460
commit
4be53a27d3
@ -264,7 +264,7 @@ CheckReservation checks if given request name contains a valid reservation
|
||||
- If there is a valid reservation, then the corresponding ImageData for the volume/snapshot is returned
|
||||
- If there is a reservation that is stale (or not fully cleaned up), it is garbage collected using
|
||||
the UndoReservation call, as appropriate
|
||||
- If a snapshot is being checked, then its source is matched to the parentName that is provided
|
||||
- If a snapshot is being checked, then its source is matched to the snapParentName that is provided
|
||||
|
||||
NOTE: As the function manipulates omaps, it should be called with a lock against the request name
|
||||
held, to prevent parallel operations from modifying the state of the omaps for this request name.
|
||||
@ -275,7 +275,7 @@ Return values:
|
||||
- error: non-nil in case of any errors
|
||||
*/
|
||||
func (conn *Connection) CheckReservation(ctx context.Context,
|
||||
journalPool, reqName, namePrefix, parentName, kmsConfig string) (*ImageData, error) {
|
||||
journalPool, reqName, namePrefix, snapParentName, kmsConfig string) (*ImageData, error) {
|
||||
var (
|
||||
snapSource bool
|
||||
objUUID string
|
||||
@ -284,7 +284,7 @@ func (conn *Connection) CheckReservation(ctx context.Context,
|
||||
cj = conn.config
|
||||
)
|
||||
|
||||
if parentName != "" {
|
||||
if snapParentName != "" {
|
||||
if cj.cephSnapSourceKey == "" {
|
||||
err := errors.New("invalid request, cephSnapSourceKey is nil")
|
||||
|
||||
@ -378,12 +378,12 @@ func (conn *Connection) CheckReservation(ctx context.Context,
|
||||
|
||||
if snapSource {
|
||||
// check if source UUID key points back to the parent volume passed in
|
||||
if savedImageAttributes.SourceName != parentName {
|
||||
if savedImageAttributes.SourceName != snapParentName {
|
||||
// NOTE: This can happen if there is a snapname conflict, and we already have a snapshot
|
||||
// with the same name pointing to a different UUID as the source
|
||||
err = fmt.Errorf("%w: snapname points to different volume, request name (%s)"+
|
||||
" source name (%s) saved source name (%s)", util.ErrSnapNameConflict,
|
||||
reqName, parentName, savedImageAttributes.SourceName)
|
||||
" source name (%s) : saved source name (%s)", util.ErrSnapNameConflict,
|
||||
reqName, snapParentName, savedImageAttributes.SourceName)
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user