@@ -303,11 +303,7 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c
303303 return updateContent , nil
304304}
305305
306- // The function goes through the whole snapshot creation process.
307- // 1. Trigger the snapshot through csi storage provider.
308- // 2. Update VolumeSnapshot status with creationtimestamp information
309- // 3. Create the VolumeSnapshotContent object with the snapshot id information.
310- // 4. Bind the VolumeSnapshot and VolumeSnapshotContent object
306+ // The function goes through the snapshot creation process.
311307func (ctrl * csiSnapshotSideCarController ) createSnapshotOperation (content * crdv1.VolumeSnapshotContent ) (* crdv1.VolumeSnapshotContent , error ) {
312308 klog .Infof ("createSnapshotOperation: Creating snapshot for content %s through the plugin ..." , content .Name )
313309
@@ -325,12 +321,12 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotOperation(content *crdv1
325321 }
326322
327323 // NOTE(xyang): handle create timeout
328- // Add annotation to indicate create snapshot request is
329- // sent to the storage system and wait for a response of success or failure .
330- // Annotation will be removed only after storage system has responded
331- // with success or failure. If the request times out, retry will happen
332- // and annotation will remain to avoid leaking of snapshot
333- // resources on the storage system
324+ // Add an annotation to indicate the snapshot creation request has been
325+ // sent to the storage system and the controller is waiting for a response .
326+ // The annotation will be removed after the storage system has responded with
327+ // success or permanent failure. If the request times out, annotation will
328+ // remain on the content to avoid potential leaking of a snapshot resource on
329+ // the storage system.
334330 err = ctrl .setAnnVolumeSnapshotBeingCreated (content )
335331 if err != nil {
336332 return nil , fmt .Errorf ("failed to add VolumeSnapshotBeingCreated annotation on the content %s: %q" , content .Name , err )
@@ -341,8 +337,10 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotOperation(content *crdv1
341337 // NOTE(xyang): handle create timeout
342338 // If it is not a timeout error, remove annotation to indicate
343339 // storage system has responded with an error
340+ klog .Infof ("createSnapshotOperation: CreateSnapshot for content %s returned error: %v" , content .Name , err )
344341 if e , ok := status .FromError (err ); ok {
345- if e .Code () == codes .DeadlineExceeded {
342+ klog .Infof ("createSnapshotOperation: CreateSnapshot for content %s error status: %+v" , content .Name , e )
343+ if e .Code () != codes .DeadlineExceeded {
346344 err = ctrl .removeAnnVolumeSnapshotBeingCreated (content )
347345 if err != nil {
348346 return nil , fmt .Errorf ("failed to remove VolumeSnapshotBeingCreated annotation from the content %s: %q" , content .Name , err )
@@ -372,12 +370,6 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotOperation(content *crdv1
372370 return nil , fmt .Errorf ("failed to remove VolumeSnapshotBeingCreated annotation on the content %s: %q" , content .Name , err )
373371 }
374372
375- // Update content in the cache store
376- _ , err = ctrl .storeContentUpdate (content )
377- if err != nil {
378- klog .Errorf ("failed to update content store %v" , err )
379- }
380-
381373 return content , nil
382374}
383375
0 commit comments