Skip to content

Commit

Permalink
Rename Ready to ReadyToUse
Browse files Browse the repository at this point in the history
This PR renames Ready to ReadyToUse in VolumeSnapshot Status
to be consistent with the name in CSI spec.
  • Loading branch information
xing-yang committed Nov 27, 2018
1 parent 2840dd8 commit bfba4cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/apis/volumesnapshot/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ type VolumeSnapshotStatus struct {
// +optional
RestoreSize *resource.Quantity `json:"restoreSize" protobuf:"bytes,2,opt,name=restoreSize"`

// Ready is set to true only if the snapshot is ready to use (e.g., finish uploading if
// ReadyToUse is set to true only if the snapshot is ready to use (e.g., finish uploading if
// there is an uploading phase) and also VolumeSnapshot and its VolumeSnapshotContent
// bind correctly with each other. If any of the above condition is not true, Ready is
// bind correctly with each other. If any of the above condition is not true, ReadyToUse is
// set to false
// +optional
Ready bool `json:"ready" protobuf:"varint,3,opt,name=ready"`
ReadyToUse bool `json:"readyToUse" protobuf:"varint,3,opt,name=readyToUse"`

// The last error encountered during create snapshot operation, if any.
// This field must only be set by the entity completing the create snapshot
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ func newSnapshot(name, className, boundToContent, snapshotUID, claimName string,
},
Status: crdv1.VolumeSnapshotStatus{
CreationTime: creationTime,
Ready: ready,
ReadyToUse: ready,
Error: err,
RestoreSize: size,
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (ctrl *csiSnapshotController) syncContent(content *crdv1.VolumeSnapshotCont
func (ctrl *csiSnapshotController) syncSnapshot(snapshot *crdv1.VolumeSnapshot) error {
glog.V(5).Infof("synchonizing VolumeSnapshot[%s]: %s", snapshotKey(snapshot), getSnapshotStatusForLogging(snapshot))

if !snapshot.Status.Ready {
if !snapshot.Status.ReadyToUse {
return ctrl.syncUnreadySnapshot(snapshot)
} else {
return ctrl.syncReadySnapshot(snapshot)
Expand Down Expand Up @@ -379,7 +379,7 @@ func (ctrl *csiSnapshotController) updateSnapshotErrorStatusWithEvent(snapshot *
}
snapshotClone.Status.Error = statusError

snapshotClone.Status.Ready = false
snapshotClone.Status.ReadyToUse = false
newSnapshot, err := ctrl.clientset.VolumesnapshotV1alpha1().VolumeSnapshots(snapshotClone.Namespace).Update(snapshotClone)
if err != nil {
glog.V(4).Infof("updating VolumeSnapshot[%s] error status failed %v", snapshotKey(snapshot), err)
Expand All @@ -399,7 +399,7 @@ func (ctrl *csiSnapshotController) updateSnapshotErrorStatusWithEvent(snapshot *

// Stateless functions
func getSnapshotStatusForLogging(snapshot *crdv1.VolumeSnapshot) string {
return fmt.Sprintf("bound to: %q, Completed: %v", snapshot.Spec.SnapshotContentName, snapshot.Status.Ready)
return fmt.Sprintf("bound to: %q, Completed: %v", snapshot.Spec.SnapshotContentName, snapshot.Status.ReadyToUse)
}

func IsSnapshotBound(snapshot *crdv1.VolumeSnapshot, content *crdv1.VolumeSnapshotContent) bool {
Expand Down Expand Up @@ -721,7 +721,7 @@ func (ctrl *csiSnapshotController) updateSnapshotStatus(snapshot *crdv1.VolumeSn
snapshotClone := snapshot.DeepCopy()
if readyToUse {
if bound {
status.Ready = true
status.ReadyToUse = true
// Remove the error if checking snapshot is already bound and ready
status.Error = nil
change = true
Expand Down

0 comments on commit bfba4cb

Please sign in to comment.