Check ReadyToUse in sidecar

This commit is contained in:
xing-yang
2019-12-30 04:41:01 +00:00
parent 81797595c8
commit 1ca3435c43

View File

@@ -80,6 +80,13 @@ func (ctrl *csiSnapshotSideCarController) syncContent(content *crdv1.VolumeSnaps
return err
}
} else {
// Skip checkandUpdateContentStatus() if ReadyToUse is
// already true. We don't want to keep calling CreateSnapshot
// or ListSnapshots CSI methods over and over again for
// performance reasons.
if content.Status != nil && content.Status.ReadyToUse != nil && *content.Status.ReadyToUse == true {
return nil
}
if err = ctrl.checkandUpdateContentStatus(content); err != nil {
ctrl.updateContentErrorStatusWithEvent(content, v1.EventTypeWarning, "SnapshotContentStatusUpdateFailed", fmt.Sprintf("Failed to update snapshot content status with error %v", err))
return err