Skip to content

Commit

Permalink
checkandUpdateContentStatusOperation should not call createSnapshotOp…
Browse files Browse the repository at this point in the history
…eration
  • Loading branch information
xing-yang committed Apr 2, 2020
1 parent 0189c77 commit f32313b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/sidecar-controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c
}
return updatedContent, nil
} else {
return ctrl.createSnapshotOperation(content)
return ctrl.createSnapshotWrapper(content)
}
}

Expand All @@ -307,6 +307,13 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotOperation(content *crdv1
return content, nil
}

return ctrl.createSnapshotWrapper(content)
}

// This is a wrapper function for the snapshot creation process.
func (ctrl *csiSnapshotSideCarController) createSnapshotWrapper(content *crdv1.VolumeSnapshotContent) (*crdv1.VolumeSnapshotContent, error) {
klog.Infof("createSnapshotWrapper: Creating snapshot for content %s through the plugin ...", content.Name)

class, snapshotterCredentials, err := ctrl.getCSISnapshotInput(content)
if err != nil {
return nil, fmt.Errorf("failed to get input parameters to create snapshot for content %s: %q", content.Name, err)
Expand All @@ -329,7 +336,7 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotOperation(content *crdv1
// NOTE(xyang): handle create timeout
// If it is a final error, remove annotation to indicate
// storage system has responded with an error
klog.Infof("createSnapshotOperation: CreateSnapshot for content %s returned error: %v", content.Name, err)
klog.Infof("createSnapshotWrapper: CreateSnapshot for content %s returned error: %v", content.Name, err)
if isFinalError(err) {
err = ctrl.removeAnnVolumeSnapshotBeingCreated(content)
if err != nil {
Expand Down

0 comments on commit f32313b

Please sign in to comment.