Skip to content

Commit bba3584

Browse files
authored
Merge pull request #218 from ggriffiths/fix_errshadow_update_snapshotstatus
Fix err shadow in updateSnapshotStatus and add retry delay
2 parents 9051539 + b5f2165 commit bba3584

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/common-controller/snapshot_controller.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func (ctrl *csiSnapshotCommonController) syncUnreadySnapshot(snapshot *crdv1.Vol
344344
break
345345
}
346346
klog.V(4).Infof("failed to update snapshot %s status: %v", utils.SnapshotKey(snapshot), err)
347+
time.Sleep(ctrl.createSnapshotContentInterval)
347348
}
348349

349350
if err != nil {
@@ -406,6 +407,7 @@ func (ctrl *csiSnapshotCommonController) syncUnreadySnapshot(snapshot *crdv1.Vol
406407
break
407408
}
408409
klog.V(4).Infof("failed to update snapshot %s status: %v", utils.SnapshotKey(snapshot), err)
410+
time.Sleep(ctrl.createSnapshotContentInterval)
409411
}
410412

411413
if err != nil {
@@ -865,16 +867,17 @@ func (ctrl *csiSnapshotCommonController) bindandUpdateVolumeSnapshot(snapshotCon
865867

866868
// Copy the snapshot object before updating it
867869
snapshotCopy := snapshotObj.DeepCopy()
868-
869870
// update snapshot status
871+
var updateSnapshot *crdv1.VolumeSnapshot
870872
for i := 0; i < ctrl.createSnapshotContentRetryCount; i++ {
871873
klog.V(5).Infof("bindandUpdateVolumeSnapshot [%s]: trying to update snapshot status", utils.SnapshotKey(snapshotCopy))
872-
updateSnapshot, err := ctrl.updateSnapshotStatus(snapshotCopy, snapshotContent)
874+
updateSnapshot, err = ctrl.updateSnapshotStatus(snapshotCopy, snapshotContent)
873875
if err == nil {
874876
snapshotCopy = updateSnapshot
875877
break
876878
}
877879
klog.V(4).Infof("failed to update snapshot %s status: %v", utils.SnapshotKey(snapshot), err)
880+
time.Sleep(ctrl.createSnapshotContentInterval)
878881
}
879882

880883
if err != nil {

0 commit comments

Comments
 (0)