Skip to content

Commit

Permalink
Merge pull request #16 from huffmanca/BZ1814280
Browse files Browse the repository at this point in the history
Bug 1814280: UPSTREAM 278: Include a nil check for the snapshotContent
  • Loading branch information
openshift-merge-robot committed Mar 20, 2020
2 parents ea11bc3 + 4b22aa2 commit eb6d3ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/common-controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (ctrl *csiSnapshotCommonController) checkandRemoveSnapshotFinalizersAndChec
}

if !inUse {
klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Set VolumeSnapshotBeingDeleted annotation on the content [%s]", content.Name)
klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Set VolumeSnapshotBeingDeleted annotation on the content")
ctrl.setAnnVolumeSnapshotBeingDeleted(content)

klog.V(5).Infof("checkandRemoveSnapshotFinalizersAndCheckandDeleteContent: Remove Finalizer for VolumeSnapshot[%s]", utils.SnapshotKey(snapshot))
Expand Down Expand Up @@ -1295,6 +1295,9 @@ func (ctrl *csiSnapshotCommonController) getSnapshotFromStore(snapshotName strin
}

func (ctrl *csiSnapshotCommonController) setAnnVolumeSnapshotBeingDeleted(content *crdv1.VolumeSnapshotContent) error {
if content == nil {
return nil
}
// Set AnnVolumeSnapshotBeingDeleted if it is not set yet
if !metav1.HasAnnotation(content.ObjectMeta, utils.AnnVolumeSnapshotBeingDeleted) {
klog.V(5).Infof("setAnnVolumeSnapshotBeingDeleted: set annotation [%s] on content [%s].", utils.AnnVolumeSnapshotBeingDeleted, content.Name)
Expand Down

0 comments on commit eb6d3ac

Please sign in to comment.