Skip to content

Commit

Permalink
fix(targetip): Removing wait on setting target ip for CVR (#144)
Browse files Browse the repository at this point in the history
* Removing wait on setting target ip for CVR

Signed-off-by: mayank <mayank.patel@mayadata.io>
  • Loading branch information
mynktl committed Jan 4, 2021
1 parent 71ee54f commit 21c3638
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/144-mynktl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removing wait on setting target-ip for CVR. This fixes the restore for application pod having target-affinity set.
17 changes: 4 additions & 13 deletions pkg/cstor/cvr_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ func (p *Plugin) waitForAllCVRs(vol *Volume) error {
return p.waitForAllCVRsToBeInValidStatus(vol, validCvrStatuses)
}

// waitForTargetIpToBeSetInAllCVRs will ensure that all CVR had
// target ip set in zfs
func (p *Plugin) waitForTargetIpToBeSetInAllCVRs(vol *Volume) error {
return p.waitForAllCVRsToBeInValidStatus(vol, validCvrStatusesWithoutError)
}

func (p *Plugin) waitForAllCVRsToBeInValidStatus(vol *Volume, statuses []string) error {
replicaCount := p.getCVRCount(vol.volname, vol.isCSIVolume)
if replicaCount == -1 {
Expand Down Expand Up @@ -164,8 +158,9 @@ func (p *Plugin) getCVRCount(volname string, isCSIVolume bool) int {
return obj.Spec.ReplicationFactor
}

// markCVRsAsRestoreCompleted wait for all CVRs to be ready, then marks CVRs are restore completed
// and wait for CVRs to be in non-error state
// markCVRsAsRestoreCompleted annotate relevant CVR with restoreCompletedAnnotation
// Note: It will not wait for CVR to become healthy. This is mainly to avoid the scenarios
// where target-affinity is used.
func (p *Plugin) markCVRsAsRestoreCompleted(vol *Volume) error {
p.Log.Infof("Waiting for all CVRs to be ready")
if err := p.waitForAllCVRs(vol); err != nil {
Expand All @@ -178,11 +173,7 @@ func (p *Plugin) markCVRsAsRestoreCompleted(vol *Volume) error {
return err
}

p.Log.Infof("Waiting for target ip to be set on all CVRs")
if err := p.waitForTargetIpToBeSetInAllCVRs(vol); err != nil {
return err
}

p.Log.Infof("Successfully annotated all CVRs")
return nil
}

Expand Down

0 comments on commit 21c3638

Please sign in to comment.