@@ -234,7 +234,7 @@ func (ctrl *csiSnapshotCommonController) getClaimsFromVolumeGroupSnapshot(groupS
234234
235235// updateGroupSnapshot runs in worker thread and handles "groupsnapshot added",
236236// "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 {
238238 // Store the new group snapshot version in the cache and do not process it
239239 // if this is an old version.
240240 klog .V (5 ).Infof ("updateGroupSnapshot %q" , utils .GroupSnapshotKey (groupSnapshot ))
@@ -246,7 +246,7 @@ func (ctrl *csiSnapshotCommonController) updateGroupSnapshot(groupSnapshot *crdv
246246 return nil
247247 }
248248
249- err = ctrl .syncGroupSnapshot (groupSnapshot )
249+ err = ctrl .syncGroupSnapshot (ctx , groupSnapshot )
250250 if err != nil {
251251 if errors .IsConflict (err ) {
252252 // Version conflict error happens quite often and the controller
@@ -294,7 +294,7 @@ func (ctrl *csiSnapshotCommonController) deleteGroupSnapshot(groupSnapshot *crdv
294294// a group snapshot is created, updated or periodically synced. We do not
295295// differentiate between these events.
296296// 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 {
298298 klog .V (5 ).Infof ("synchronizing VolumeGroupSnapshot[%s]" , utils .GroupSnapshotKey (groupSnapshot ))
299299
300300 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
326326 // 3) groupSnapshot.Status.IsBoundVolumeGroupSnapshotContentNameSet is not set
327327 // 4) groupSnapshot.Status.IsVolumeSnapshotRefListSet is not set
328328 if ! utils .IsGroupSnapshotReady (groupSnapshot ) || ! utils .IsBoundVolumeGroupSnapshotContentNameSet (groupSnapshot ) || ! utils .IsPVCVolumeSnapshotRefListSet (groupSnapshot ) {
329- return ctrl .syncUnreadyGroupSnapshot (groupSnapshot )
329+ return ctrl .syncUnreadyGroupSnapshot (ctx , groupSnapshot )
330330 }
331331 return ctrl .syncReadyGroupSnapshot (groupSnapshot )
332332}
@@ -383,7 +383,7 @@ func (ctrl *csiSnapshotCommonController) getGroupSnapshotContentFromStore(conten
383383
384384// syncUnreadyGroupSnapshot is the main controller method to decide what to do
385385// 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 {
387387 uniqueGroupSnapshotName := utils .GroupSnapshotKey (groupSnapshot )
388388 klog .V (5 ).Infof ("syncUnreadyGroupSnapshot %s" , uniqueGroupSnapshotName )
389389 driverName , err := ctrl .getGroupSnapshotDriverName (groupSnapshot )
@@ -460,8 +460,7 @@ func (ctrl *csiSnapshotCommonController) syncUnreadyGroupSnapshot(groupSnapshot
460460 return fmt .Errorf ("VolumeGroupSnapshotHandle should not be set in the group snapshot content for dynamic provisioning for group snapshot %s" , uniqueGroupSnapshotName )
461461 }
462462
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 )
465464 if err != nil {
466465 klog .V (4 ).Infof ("createSnapshotsForGroupSnapshotContent[%s]: failed to create snapshots and snapshotcontents for group snapshot %v: %v" ,
467466 contentObj .Name , groupSnapshot .Name , err .Error ())
0 commit comments