@@ -533,11 +533,7 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
533
533
"createSnapshotsForGroupSnapshotContent[%s]: creating volumesnapshots and volumesnapshotcontent for group snapshot content" ,
534
534
groupSnapshotContent .Name )
535
535
536
- groupSnapshotContent .Status .PVVolumeSnapshotContentList = make (
537
- []crdv1alpha1.PVVolumeSnapshotContentPair ,
538
- len (groupSnapshotContent .Status .VolumeSnapshotHandlePairList ),
539
- )
540
- for i , snapshot := range groupSnapshotContent .Status .VolumeSnapshotHandlePairList {
536
+ for _ , snapshot := range groupSnapshotContent .Status .VolumeSnapshotHandlePairList {
541
537
snapshotHandle := snapshot .SnapshotHandle
542
538
volumeHandle := snapshot .VolumeHandle
543
539
@@ -619,17 +615,6 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
619
615
"createSnapshotsForGroupSnapshotContent: creating volumesnapshot %w" , err )
620
616
}
621
617
622
- groupSnapshotContent .Status .PVVolumeSnapshotContentList [i ] = crdv1alpha1.PVVolumeSnapshotContentPair {
623
- VolumeSnapshotContentRef : v1.LocalObjectReference {
624
- Name : volumeSnapshotContentName ,
625
- },
626
- }
627
- if pv != nil {
628
- groupSnapshotContent .Status .PVVolumeSnapshotContentList [i ].PersistentVolumeRef = v1.LocalObjectReference {
629
- Name : pv .Name ,
630
- }
631
- }
632
-
633
618
// bind the volume snapshot content to the volume snapshot
634
619
// like a dynamically provisioned snapshot would do
635
620
volumeSnapshotContent .Spec .VolumeSnapshotRef .UID = createdVolumeSnapshot .UID
@@ -665,24 +650,7 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
665
650
}
666
651
}
667
652
668
- // Phase 2: set the backlinks
669
- var patches []utils.PatchOp
670
- patches = append (patches , utils.PatchOp {
671
- Op : "replace" ,
672
- Path : "/status/pvVolumeSnapshotContentList" ,
673
- Value : groupSnapshotContent .Status .PVVolumeSnapshotContentList ,
674
- })
675
-
676
- newGroupSnapshotObj , err := utils .PatchVolumeGroupSnapshotContent (
677
- groupSnapshotContent ,
678
- patches ,
679
- ctrl .clientset ,
680
- "status" )
681
- if err != nil {
682
- return nil , newControllerUpdateError (utils .GroupSnapshotKey (groupSnapshot ), err .Error ())
683
- }
684
-
685
- return newGroupSnapshotObj , nil
653
+ return groupSnapshotContent , nil
686
654
}
687
655
688
656
// findPersistentVolumeByCSIDriverHandle looks at an existing PersistentVolume
@@ -836,50 +804,6 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
836
804
volumeSnapshotErr = groupSnapshotContent .Status .Error .DeepCopy ()
837
805
}
838
806
839
- var pvcVolumeSnapshotRefList []crdv1alpha1.PVCVolumeSnapshotPair
840
- if groupSnapshotContent .Status != nil && len (groupSnapshotContent .Status .PVVolumeSnapshotContentList ) != 0 {
841
- for _ , contentRef := range groupSnapshotContent .Status .PVVolumeSnapshotContentList {
842
- var pvcReference v1.LocalObjectReference
843
- pv , err := ctrl .client .CoreV1 ().PersistentVolumes ().Get (context .TODO (), contentRef .PersistentVolumeRef .Name , metav1.GetOptions {})
844
- if err != nil {
845
- if apierrs .IsNotFound (err ) {
846
- klog .Errorf (
847
- "updateGroupSnapshotStatus[%s]: PV [%s] not found" ,
848
- utils .GroupSnapshotKey (groupSnapshot ),
849
- contentRef .PersistentVolumeRef .Name ,
850
- )
851
- } else {
852
- klog .Errorf (
853
- "updateGroupSnapshotStatus[%s]: unable to get PV [%s] from the API server: %q" ,
854
- utils .GroupSnapshotKey (groupSnapshot ),
855
- contentRef .PersistentVolumeRef .Name ,
856
- err .Error (),
857
- )
858
- }
859
- } else {
860
- if pv .Spec .ClaimRef != nil {
861
- pvcReference .Name = pv .Spec .ClaimRef .Name
862
- } else {
863
- klog .Errorf (
864
- "updateGroupSnapshotStatus[%s]: PV [%s] is not bound" ,
865
- utils .GroupSnapshotKey (groupSnapshot ),
866
- contentRef .PersistentVolumeRef .Name )
867
- }
868
- }
869
-
870
- volumeSnapshotContent , err := ctrl .contentLister .Get (contentRef .VolumeSnapshotContentRef .Name )
871
- if err != nil {
872
- return nil , fmt .Errorf ("failed to get snapshot content %s from snapshot content store: %v" , contentRef .VolumeSnapshotContentRef .Name , err )
873
- }
874
- pvcVolumeSnapshotRefList = append (pvcVolumeSnapshotRefList , crdv1alpha1.PVCVolumeSnapshotPair {
875
- VolumeSnapshotRef : v1.LocalObjectReference {
876
- Name : volumeSnapshotContent .Spec .VolumeSnapshotRef .Name ,
877
- },
878
- PersistentVolumeClaimRef : pvcReference ,
879
- })
880
- }
881
- }
882
-
883
807
klog .V (5 ).Infof ("updateGroupSnapshotStatus: updating VolumeGroupSnapshot [%+v] based on VolumeGroupSnapshotContentStatus [%+v]" , groupSnapshot , groupSnapshotContent .Status )
884
808
885
809
groupSnapshotObj , err := ctrl .clientset .GroupsnapshotV1alpha1 ().VolumeGroupSnapshots (groupSnapshot .Namespace ).Get (context .TODO (), groupSnapshot .Name , metav1.GetOptions {})
@@ -900,9 +824,6 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
900
824
if volumeSnapshotErr != nil {
901
825
newStatus .Error = volumeSnapshotErr
902
826
}
903
- if len (pvcVolumeSnapshotRefList ) == 0 {
904
- newStatus .PVCVolumeSnapshotRefList = pvcVolumeSnapshotRefList
905
- }
906
827
907
828
updated = true
908
829
} else {
@@ -926,10 +847,6 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
926
847
newStatus .Error = volumeSnapshotErr
927
848
updated = true
928
849
}
929
- if len (newStatus .PVCVolumeSnapshotRefList ) == 0 {
930
- newStatus .PVCVolumeSnapshotRefList = pvcVolumeSnapshotRefList
931
- updated = true
932
- }
933
850
}
934
851
935
852
if updated {
0 commit comments