@@ -315,7 +315,7 @@ func (ctrl *csiSnapshotCommonController) syncGroupSnapshot(groupSnapshot *crdv1a
315
315
// 2) groupSnapshot.Status.ReadyToUse is false
316
316
// 3) groupSnapshot.Status.IsBoundVolumeGroupSnapshotContentNameSet is not set
317
317
// 4) groupSnapshot.Status.IsVolumeSnapshotRefListSet is not set
318
- if ! utils .IsGroupSnapshotReady (groupSnapshot ) || ! utils .IsBoundVolumeGroupSnapshotContentNameSet (groupSnapshot ) || ! utils .IsVolumeSnapshotRefListSet (groupSnapshot ) {
318
+ if ! utils .IsGroupSnapshotReady (groupSnapshot ) || ! utils .IsBoundVolumeGroupSnapshotContentNameSet (groupSnapshot ) || ! utils .IsPVCVolumeSnapshotRefListSet (groupSnapshot ) {
319
319
return ctrl .syncUnreadyGroupSnapshot (groupSnapshot )
320
320
}
321
321
return ctrl .syncReadyGroupSnapshot (groupSnapshot )
@@ -564,14 +564,16 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
564
564
volumeSnapshotErr = groupSnapshotContent .Status .Error .DeepCopy ()
565
565
}
566
566
567
- var volumeSnapshotRefList []v1. ObjectReference
568
- if groupSnapshotContent .Status != nil && len (groupSnapshotContent .Status .VolumeSnapshotContentRefList ) != 0 {
569
- for _ , contentRef := range groupSnapshotContent .Status .VolumeSnapshotContentRefList {
570
- groupSnapshotContent , err := ctrl .contentLister .Get (contentRef .Name )
567
+ var pvcVolumeSnapshotRefList []crdv1alpha1. PVCVolumeSnapshotPair
568
+ if groupSnapshotContent .Status != nil && len (groupSnapshotContent .Status .PVVolumeSnapshotContentRefList ) != 0 {
569
+ for _ , contentRef := range groupSnapshotContent .Status .PVVolumeSnapshotContentRefList {
570
+ groupSnapshotContent , err := ctrl .contentLister .Get (contentRef .VolumeSnapshotContentName )
571
571
if err != nil {
572
- return nil , fmt .Errorf ("failed to get group snapshot content %s from group snapshot content store: %v" , contentRef .Name , err )
572
+ return nil , fmt .Errorf ("failed to get group snapshot content %s from group snapshot content store: %v" , contentRef .VolumeSnapshotContentName , err )
573
573
}
574
- volumeSnapshotRefList = append (volumeSnapshotRefList , groupSnapshotContent .Spec .VolumeSnapshotRef )
574
+ pvcVolumeSnapshotRefList = append (pvcVolumeSnapshotRefList , crdv1alpha1.PVCVolumeSnapshotPair {
575
+ VolumeSnapshotRef : groupSnapshotContent .Spec .VolumeSnapshotRef ,
576
+ })
575
577
}
576
578
}
577
579
@@ -595,8 +597,8 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
595
597
if volumeSnapshotErr != nil {
596
598
newStatus .Error = volumeSnapshotErr
597
599
}
598
- if len (volumeSnapshotRefList ) == 0 {
599
- newStatus .VolumeSnapshotRefList = volumeSnapshotRefList
600
+ if len (pvcVolumeSnapshotRefList ) == 0 {
601
+ newStatus .PVCVolumeSnapshotRefList = pvcVolumeSnapshotRefList
600
602
}
601
603
602
604
updated = true
@@ -621,8 +623,8 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshotStatus(groupSnapshot
621
623
newStatus .Error = volumeSnapshotErr
622
624
updated = true
623
625
}
624
- if len (newStatus .VolumeSnapshotRefList ) == 0 {
625
- newStatus .VolumeSnapshotRefList = volumeSnapshotRefList
626
+ if len (newStatus .PVCVolumeSnapshotRefList ) == 0 {
627
+ newStatus .PVCVolumeSnapshotRefList = pvcVolumeSnapshotRefList
626
628
updated = true
627
629
}
628
630
}
@@ -1137,8 +1139,8 @@ func (ctrl *csiSnapshotCommonController) processGroupSnapshotWithDeletionTimesta
1137
1139
// check if an individual snapshot belonging to the group snapshot is being
1138
1140
// used for restore a PVC
1139
1141
// If yes, do nothing and wait until PVC restoration finishes
1140
- for _ , snapshotRef := range groupSnapshot .Status .VolumeSnapshotRefList {
1141
- snapshot , err := ctrl .snapshotLister .VolumeSnapshots (snapshotRef .Namespace ).Get (snapshotRef .Name )
1142
+ for _ , snapshotRef := range groupSnapshot .Status .PVCVolumeSnapshotRefList {
1143
+ snapshot , err := ctrl .snapshotLister .VolumeSnapshots (snapshotRef .VolumeSnapshotRef . Namespace ).Get (snapshotRef . VolumeSnapshotRef .Name )
1142
1144
if err != nil {
1143
1145
if apierrs .IsNotFound (err ) {
1144
1146
continue
@@ -1185,10 +1187,10 @@ func (ctrl *csiSnapshotCommonController) processGroupSnapshotWithDeletionTimesta
1185
1187
klog .V (5 ).Infof ("processGroupSnapshotWithDeletionTimestamp[%s]: Delete individual snapshots that are part of the group snapshot" , utils .GroupSnapshotKey (groupSnapshot ))
1186
1188
1187
1189
// Delete the individual snapshots part of the group snapshot
1188
- for _ , snapshot := range groupSnapshot .Status .VolumeSnapshotRefList {
1189
- err := ctrl .clientset .SnapshotV1 ().VolumeSnapshots (snapshot .Namespace ).Delete (context .TODO (), snapshot .Name , metav1.DeleteOptions {})
1190
+ for _ , snapshot := range groupSnapshot .Status .PVCVolumeSnapshotRefList {
1191
+ err := ctrl .clientset .SnapshotV1 ().VolumeSnapshots (snapshot .VolumeSnapshotRef . Namespace ).Delete (context .TODO (), snapshot . VolumeSnapshotRef .Name , metav1.DeleteOptions {})
1190
1192
if err != nil && ! apierrs .IsNotFound (err ) {
1191
- msg := fmt .Sprintf ("failed to delete snapshot API object %s/%s part of group snapshot %s: %v" , snapshot .Namespace , snapshot .Name , utils .GroupSnapshotKey (groupSnapshot ), err )
1193
+ msg := fmt .Sprintf ("failed to delete snapshot API object %s/%s part of group snapshot %s: %v" , snapshot .VolumeSnapshotRef . Namespace , snapshot . VolumeSnapshotRef .Name , utils .GroupSnapshotKey (groupSnapshot ), err )
1192
1194
klog .Error (msg )
1193
1195
ctrl .eventRecorder .Event (groupSnapshot , v1 .EventTypeWarning , "SnapshotDeleteError" , msg )
1194
1196
return fmt .Errorf (msg )
0 commit comments