Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/controller/snapshot_controller_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ func (ctrl *csiSnapshotController) snapshotWorker() {
glog.Errorf("expected vs, got %+v", vsObj)
return false
}
newSnapshot, err := ctrl.checkAndUpdateSnapshotClass(snapshot)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is still needed because some CSI plugins need to use secrets stored in SnapshotClass to delete the snapshot.

Copy link
Collaborator Author

@jingxu97 jingxu97 Oct 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then deletion will fail with some error msg in that case? I am ok to add it back. When I checked pv controller, I don't think they check storage class before deleting PV.

if err == nil {
ctrl.deleteSnapshot(newSnapshot)
}
ctrl.deleteSnapshot(snapshot)
return false
}

Expand Down Expand Up @@ -339,6 +336,10 @@ func (ctrl *csiSnapshotController) isDriverMatch(content *crdv1.VolumeSnapshotCo
// gets it from default VolumeSnapshotClass and sets it. It also detects if snapshotter in the
// VolumeSnapshotClass is the same as the snapshotter in external controller.
func (ctrl *csiSnapshotController) checkAndUpdateSnapshotClass(snapshot *crdv1.VolumeSnapshot) (*crdv1.VolumeSnapshot, error) {
// if snapshot status is already ready, skip the snapshot class check since snapshot is already taken
if snapshot.Status.Ready {
return snapshot, nil
}
className := snapshot.Spec.VolumeSnapshotClassName
var class *crdv1.VolumeSnapshotClass
var err error
Expand Down