Skip to content

Commit

Permalink
adding checks for delete in progress (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bathina2 committed Sep 24, 2021
1 parent a44b47f commit 491f0b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/blockstorage/awsefs/awsefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ func (e *efs) SnapshotDelete(ctx context.Context, snapshot *blockstorage.Snapsho
if isResourceNotFoundException(err) {
return nil
}
if isDeleteInProgress(err) {
return nil
}
return err
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/blockstorage/awsefs/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package awsefs

import (
"strings"

"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/backup"
awsefs "github.com/aws/aws-sdk-go/service/efs"
Expand Down Expand Up @@ -50,3 +52,13 @@ func isMountTargetNotFound(err error) bool {
}
return false
}

func isDeleteInProgress(err error) bool {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == backup.ErrCodeInvalidRequestException &&
strings.Contains(awsErr.Message(), "Recovery point already started the deletion process") {
return true
}
}
return false
}

0 comments on commit 491f0b2

Please sign in to comment.