@@ -234,7 +234,7 @@ func (ctrl *csiSnapshotCommonController) getClaimsFromVolumeGroupSnapshot(groupS
234
234
235
235
// updateGroupSnapshot runs in worker thread and handles "groupsnapshot added",
236
236
// "groupsnapshot updated" and "periodic sync" events.
237
- func (ctrl * csiSnapshotCommonController ) updateGroupSnapshot (groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
237
+ func (ctrl * csiSnapshotCommonController ) updateGroupSnapshot (ctx context. Context , groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
238
238
// Store the new group snapshot version in the cache and do not process it
239
239
// if this is an old version.
240
240
klog .V (5 ).Infof ("updateGroupSnapshot %q" , utils .GroupSnapshotKey (groupSnapshot ))
@@ -246,7 +246,7 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshot(groupSnapshot *crdv
246
246
return nil
247
247
}
248
248
249
- err = ctrl .syncGroupSnapshot (groupSnapshot )
249
+ err = ctrl .syncGroupSnapshot (ctx , groupSnapshot )
250
250
if err != nil {
251
251
if errors .IsConflict (err ) {
252
252
// Version conflict error happens quite often and the controller
@@ -294,7 +294,7 @@ func (ctrl *csiSnapshotCommonController) deleteGroupSnapshot(groupSnapshot *crdv
294
294
// a group snapshot is created, updated or periodically synced. We do not
295
295
// differentiate between these events.
296
296
// For easier readability, it is split into syncUnreadyGroupSnapshot and syncReadyGroupSnapshot
297
- func (ctrl * csiSnapshotCommonController ) syncGroupSnapshot (groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
297
+ func (ctrl * csiSnapshotCommonController ) syncGroupSnapshot (ctx context. Context , groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
298
298
klog .V (5 ).Infof ("synchronizing VolumeGroupSnapshot[%s]" , utils .GroupSnapshotKey (groupSnapshot ))
299
299
300
300
klog .V (5 ).Infof ("syncGroupSnapshot [%s]: check if we should remove finalizer on group snapshot PVC source and remove it if we can" , utils .GroupSnapshotKey (groupSnapshot ))
@@ -326,7 +326,7 @@ func (ctrl *csiSnapshotCommonController) syncGroupSnapshot(groupSnapshot *crdv1a
326
326
// 3) groupSnapshot.Status.IsBoundVolumeGroupSnapshotContentNameSet is not set
327
327
// 4) groupSnapshot.Status.IsVolumeSnapshotRefListSet is not set
328
328
if ! utils .IsGroupSnapshotReady (groupSnapshot ) || ! utils .IsBoundVolumeGroupSnapshotContentNameSet (groupSnapshot ) || ! utils .IsPVCVolumeSnapshotRefListSet (groupSnapshot ) {
329
- return ctrl .syncUnreadyGroupSnapshot (groupSnapshot )
329
+ return ctrl .syncUnreadyGroupSnapshot (ctx , groupSnapshot )
330
330
}
331
331
return ctrl .syncReadyGroupSnapshot (groupSnapshot )
332
332
}
@@ -383,7 +383,7 @@ func (ctrl *csiSnapshotCommonController) getGroupSnapshotContentFromStore(conten
383
383
384
384
// syncUnreadyGroupSnapshot is the main controller method to decide what to do
385
385
// with a group snapshot which is not set to ready.
386
- func (ctrl * csiSnapshotCommonController ) syncUnreadyGroupSnapshot (groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
386
+ func (ctrl * csiSnapshotCommonController ) syncUnreadyGroupSnapshot (ctx context. Context , groupSnapshot * crdv1alpha1.VolumeGroupSnapshot ) error {
387
387
uniqueGroupSnapshotName := utils .GroupSnapshotKey (groupSnapshot )
388
388
klog .V (5 ).Infof ("syncUnreadyGroupSnapshot %s" , uniqueGroupSnapshotName )
389
389
driverName , err := ctrl .getGroupSnapshotDriverName (groupSnapshot )
@@ -460,8 +460,7 @@ func (ctrl *csiSnapshotCommonController) syncUnreadyGroupSnapshot(groupSnapshot
460
460
return fmt .Errorf ("VolumeGroupSnapshotHandle should not be set in the group snapshot content for dynamic provisioning for group snapshot %s" , uniqueGroupSnapshotName )
461
461
}
462
462
463
- // TODO(leonardoce): introduce a current context in this function
464
- newGroupSnapshotContentObj , err := ctrl .createSnapshotsForGroupSnapshotContent (context .TODO (), contentObj , groupSnapshot )
463
+ newGroupSnapshotContentObj , err := ctrl .createSnapshotsForGroupSnapshotContent (ctx , contentObj , groupSnapshot )
465
464
if err != nil {
466
465
klog .V (4 ).Infof ("createSnapshotsForGroupSnapshotContent[%s]: failed to create snapshots and snapshotcontents for group snapshot %v: %v" ,
467
466
contentObj .Name , groupSnapshot .Name , err .Error ())
0 commit comments