Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip RG status poll/update if any action is being executed #69

Merged
merged 2 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions controllers/csi-replicator/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,16 @@ func updateRGLinkStatus(ctx context.Context, client client.Client, rg *storagev1

func (r *ReplicationGroupMonitoring) isUpdateRequired(rg storagev1alpha1.DellCSIReplicationGroup) bool {
currTime := time.Now()
if rg.Status.ReplicationLinkState.LastSuccessfulUpdate.IsZero() {
lastTime := rg.Status.ReplicationLinkState.LastSuccessfulUpdate
if lastTime.IsZero() {
return true
}
lastTime := rg.Status.ReplicationLinkState.LastSuccessfulUpdate.Time
// Need to wait for at least MonitoringInterval before updating the RG again
if currTime.Sub(lastTime) < r.MonitoringInterval {

// Skip update if any action is being executed
if rg.Spec.Action != "" {
return false
}
return true

// Need to wait for at least MonitoringInterval before updating the RG again
return currTime.Sub(lastTime.Time) >= r.MonitoringInterval
}
4 changes: 2 additions & 2 deletions repctl/pkg/cmd/failback.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func failbackToRG(configFolder, rgName string, discard, verbose bool, wait bool)
return

}
log.Printf("RG (%s), successfully updated with action: faiback\n", rg.Name)
log.Printf("RG (%s), successfully updated with action: failback\n", rg.Name)
}

func failbackToCluster(configFolder, inputSourceCluster, rgName string, discard, verbose bool, wait bool) {
Expand Down Expand Up @@ -170,5 +170,5 @@ func failbackToCluster(configFolder, inputSourceCluster, rgName string, discard,
return

}
log.Printf("RG (%s), successfully updated with action: faiback\n", rg.Name)
log.Printf("RG (%s), successfully updated with action: failback\n", rg.Name)
}