@@ -609,7 +609,7 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
609609 },
610610 Spec : crdv1.VolumeSnapshotSpec {
611611 Source : crdv1.VolumeSnapshotSource {
612- VolumeSnapshotContentName : & volumeSnapshotContentName ,
612+ PersistentVolumeClaimName : & pv . Spec . ClaimRef . Name ,
613613 },
614614 },
615615 // The status will be set by VolumeSnapshot reconciler
@@ -621,7 +621,7 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
621621 "createSnapshotsForGroupSnapshotContent: creating volumesnapshotcontent %w" , err )
622622 }
623623
624- _ , err = ctrl .clientset .SnapshotV1 ().VolumeSnapshots (volumeSnapshotNamespace ).Create (ctx , volumeSnapshot , metav1.CreateOptions {})
624+ createdVolumeSnapshot , err : = ctrl .clientset .SnapshotV1 ().VolumeSnapshots (volumeSnapshotNamespace ).Create (ctx , volumeSnapshot , metav1.CreateOptions {})
625625 if err != nil && ! apierrs .IsAlreadyExists (err ) {
626626 return groupSnapshotContent , fmt .Errorf (
627627 "createSnapshotsForGroupSnapshotContent: creating volumesnapshot %w" , err )
@@ -637,6 +637,40 @@ func (ctrl *csiSnapshotCommonController) createSnapshotsForGroupSnapshotContent(
637637 Name : pv .Name ,
638638 }
639639 }
640+
641+ // bind the volume snapshot content to the volume snapshot
642+ // like a dynamically provisioned snapshot would do
643+ volumeSnapshotContent .Spec .VolumeSnapshotRef .UID = createdVolumeSnapshot .UID
644+ _ , err = utils .PatchVolumeSnapshotContent (volumeSnapshotContent , []utils.PatchOp {
645+ {
646+ Op : "replace" ,
647+ Path : "/spec/volumeSnapshotRef/uid" ,
648+ Value : volumeSnapshotContent .Spec .VolumeSnapshotRef .UID ,
649+ },
650+ }, ctrl .clientset )
651+ if err != nil {
652+ return groupSnapshotContent , fmt .Errorf (
653+ "createSnapshotsForGroupSnapshotContent: binding volumesnapshotcontent to volumesnapshot %w" , err )
654+ }
655+
656+ // bind the volume snapshot to the volume snapshot content
657+ // like a dynamically provisioned snapshot would do
658+ _ , err = utils .PatchVolumeSnapshot (createdVolumeSnapshot , []utils.PatchOp {
659+ {
660+ Op : "replace" ,
661+ Path : "/status" ,
662+ Value : & crdv1.VolumeSnapshotStatus {},
663+ },
664+ {
665+ Op : "replace" ,
666+ Path : "/status/boundVolumeSnapshotContentName" ,
667+ Value : volumeSnapshotContentName ,
668+ },
669+ }, ctrl .clientset , "status" )
670+ if err != nil {
671+ return groupSnapshotContent , fmt .Errorf (
672+ "createSnapshotsForGroupSnapshotContent: binding volumesnapshot to volumesnapshotcontent %w" , err )
673+ }
640674 }
641675
642676 // Phase 2: set the backlinks
0 commit comments