@@ -133,13 +133,6 @@ func (ctrl *csiSnapshotSideCarController) createSnapshot(content *crdv1.VolumeSn
133
133
klog .V (5 ).Infof ("createSnapshot for content [%s]: started" , content .Name )
134
134
opName := fmt .Sprintf ("create-%s" , content .Name )
135
135
ctrl .scheduleOperation (opName , func () error {
136
- // content.Status will be created for the first time after a snapshot
137
- // is created by the CSI driver. If content.Status is not nil,
138
- // we should update content status without creating snapshot again.
139
- if content .Status != nil && content .Status .Error != nil && content .Status .Error .Message != nil && ! isControllerUpdateFailError (content .Status .Error ) {
140
- klog .V (4 ).Infof ("error is already set in snapshot, do not retry to create: %s" , * content .Status .Error .Message )
141
- return nil
142
- }
143
136
contentObj , err := ctrl .createSnapshotWrapper (content )
144
137
if err != nil {
145
138
ctrl .updateContentErrorStatusWithEvent (content , v1 .EventTypeWarning , "SnapshotCreationFailed" , fmt .Sprintf ("Failed to create snapshot: %v" , err ))
@@ -311,6 +304,14 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c
311
304
func (ctrl * csiSnapshotSideCarController ) createSnapshotWrapper (content * crdv1.VolumeSnapshotContent ) (* crdv1.VolumeSnapshotContent , error ) {
312
305
klog .Infof ("createSnapshotWrapper: Creating snapshot for content %s through the plugin ..." , content .Name )
313
306
307
+ // content.Status will be created for the first time after a snapshot
308
+ // is created by the CSI driver. If content.Status is not nil,
309
+ // we should update content status without creating snapshot again.
310
+ if content .Status != nil && content .Status .Error != nil && content .Status .Error .Message != nil && ! isControllerUpdateFailError (content .Status .Error ) {
311
+ klog .V (4 ).Infof ("error is already set in snapshot, do not retry to create: %s" , * content .Status .Error .Message )
312
+ return content , nil
313
+ }
314
+
314
315
class , snapshotterCredentials , err := ctrl .getCSISnapshotInput (content )
315
316
if err != nil {
316
317
return nil , fmt .Errorf ("failed to get input parameters to create snapshot for content %s: %q" , content .Name , err )
@@ -624,7 +625,6 @@ func (ctrl *csiSnapshotSideCarController) setAnnVolumeSnapshotBeingCreated(conte
624
625
_ , err = ctrl .storeContentUpdate (content )
625
626
if err != nil {
626
627
klog .V (4 ).Infof ("setAnnVolumeSnapshotBeingCreated for content [%s]: cannot update internal cache %v" , content .Name , err )
627
- return err
628
628
}
629
629
klog .V (5 ).Infof ("setAnnVolumeSnapshotBeingCreated: volume snapshot content %+v" , content )
630
630
0 commit comments