@@ -809,23 +809,14 @@ func (ctrl *csiSnapshotCommonController) updateSnapshotErrorStatusWithEvent(snap
809809
810810// addContentFinalizer adds a Finalizer for VolumeSnapshotContent.
811811func (ctrl * csiSnapshotCommonController ) addContentFinalizer (content * crdv1.VolumeSnapshotContent ) error {
812- // patches := []utils.PatchOp{
813- // {
814- // Op: "add",
815- // Path: "/metadata/finalizers/-",
816- // Value: utils.VolumeSnapshotContentFinalizer,
817- // },
818- // }
819-
820- // newContent, err := utils.PatchVolumeSnapshotContent(content, patches, ctrl.clientset)
821- // if err != nil {
822- // return newControllerUpdateError(content.Name, err.Error())
823- // }
824-
825- contentClone := content .DeepCopy ()
826- contentClone .ObjectMeta .Finalizers = append (contentClone .ObjectMeta .Finalizers , utils .VolumeSnapshotContentFinalizer )
827-
828- newContent , err := ctrl .clientset .SnapshotV1 ().VolumeSnapshotContents ().Update (context .TODO (), contentClone , metav1.UpdateOptions {})
812+ var patches []utils.PatchOp
813+ patches = append (patches , utils.PatchOp {
814+ Op : "add" ,
815+ Path : "/metadata/finalizers/-" ,
816+ Value : utils .VolumeSnapshotContentFinalizer ,
817+ })
818+
819+ newContent , err := utils .PatchVolumeSnapshotContent (content , patches , ctrl .clientset )
829820 if err != nil {
830821 return newControllerUpdateError (content .Name , err .Error ())
831822 }
@@ -1440,8 +1431,6 @@ func (ctrl *csiSnapshotCommonController) addSnapshotFinalizer(snapshot *crdv1.Vo
14401431 })
14411432 }
14421433
1443- klog .Infof ("GGCSI - ADD SNAPSHOT FINALIZER - snapshot: %v" , snapshot )
1444- klog .Infof ("GGCSI - ADD SNAPSHOT FINALIZER - patches: %v" , patches )
14451434 updatedSnapshot , err = utils .PatchVolumeSnapshot (snapshot , patches , ctrl .clientset )
14461435 if err != nil {
14471436 return newControllerUpdateError (utils .SnapshotKey (snapshot ), err .Error ())
0 commit comments