Skip to content

Commit

Permalink
restore api to return failure if cstorrestore is in invalid state
Browse files Browse the repository at this point in the history
Signed-off-by: mayank <mayank.patel@mayadata.io>
  • Loading branch information
mayank committed May 5, 2020
1 parent f52d1c1 commit f1acfc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/cstor-pool-mgmt/controller/restore/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (c *RestoreController) syncHandler(key string, operation common.QueueOperat
return fmt.Errorf("can not retrieve CStorRestore %q", key)
}

if IsDoneStatus(rst) || IsFailedStatus(rst) {
return nil
}

status, err := c.rstEventHandler(operation, rst)
if status == "" {
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/maya-apiserver/app/server/restore_endpoint_v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func getRestoreStatus(rst *v1alpha1.CStorRestore) (v1alpha1.CStorRestoreStatus,
switch rstStatus {
case v1alpha1.RSTCStorStatusInProgress:
rstStatus = v1alpha1.RSTCStorStatusInProgress
case v1alpha1.RSTCStorStatusFailed:
case v1alpha1.RSTCStorStatusFailed, v1alpha1.RSTCStorStatusInvalid:
if nr.Status != rstStatus {
// Restore for given CVR may failed due to node failure or pool failure
// Let's update status for given CVR's restore to failed
Expand Down

0 comments on commit f1acfc1

Please sign in to comment.