Merge pull request #284 from xing-yang/error_status

Update Error in Snapshot Status
This commit is contained in:
Kubernetes Prow Robot
2020-07-21 22:46:05 -07:00
committed by GitHub
3 changed files with 106 additions and 8 deletions

View File

@@ -1031,6 +1031,10 @@ func (ctrl *csiSnapshotCommonController) updateSnapshotStatus(snapshot *crdv1.Vo
if content.Status != nil && content.Status.ReadyToUse != nil {
readyToUse = *content.Status.ReadyToUse
}
var volumeSnapshotErr *crdv1.VolumeSnapshotError
if content.Status != nil && content.Status.Error != nil {
volumeSnapshotErr = content.Status.Error.DeepCopy()
}
klog.V(5).Infof("updateSnapshotStatus: updating VolumeSnapshot [%+v] based on VolumeSnapshotContentStatus [%+v]", snapshot, content.Status)
@@ -1052,6 +1056,9 @@ func (ctrl *csiSnapshotCommonController) updateSnapshotStatus(snapshot *crdv1.Vo
if size != nil {
newStatus.RestoreSize = resource.NewQuantity(*size, resource.BinarySI)
}
if volumeSnapshotErr != nil {
newStatus.Error = volumeSnapshotErr
}
updated = true
} else {
newStatus = snapshotObj.Status.DeepCopy()
@@ -1074,6 +1081,10 @@ func (ctrl *csiSnapshotCommonController) updateSnapshotStatus(snapshot *crdv1.Vo
newStatus.RestoreSize = resource.NewQuantity(*size, resource.BinarySI)
updated = true
}
if (newStatus.Error == nil && volumeSnapshotErr != nil) || (newStatus.Error != nil && volumeSnapshotErr != nil && newStatus.Error.Time != nil && volumeSnapshotErr.Time != nil && &newStatus.Error.Time != &volumeSnapshotErr.Time) || (newStatus.Error != nil && volumeSnapshotErr == nil) {
newStatus.Error = volumeSnapshotErr
updated = true
}
}
if updated {