Repository navigation
Labels
discovered-by-testDiscovered/reported by the test team
Description
Summary
VRG deletion can leave an orphaned VolumeSnapshot with the snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection finalizer, which blocks workload namespace deletion indefinitely (namespace stuck in Terminating). This was hit by the appset-deploy-cephfs regional-DR e2e test.
The trigger is a CephFS consistency-group (CG) snapshot that never became ready (Quiesce operation is in progress) being torn down while still in flight.
Environment / where seen
- Found while running e2e for PR Fix OADP 1.6.2 regression: allow restore from backups with 'already exists' error #2974 (that PR only changes the Velero backup/restore path and is not the cause; kube-object protection was disabled in this test).
- E2E run: https://github.com/RamenDR/ramen/actions/runs/44256446252 (attempt 1), artifact
e2e.44256446252-1.tar.gz - Test:
TestDR/appset-deploy-cephfs/Undeployondr1(after failover todr2and relocate back todr1) - Failure:
Namespace "test-appset-deploy-cephfs" not deleted in cluster "dr1": context deadline exceeded(300s)
What happened
Timeline (dr1):
| Time (UTC) | Event |
|---|---|
| 07:36:02 | Relocate back to dr1 completes; VRG test-appset-deploy-cephfs/appset-deploy-cephfs is primary, workload healthy |
| 07:34–07:37 | Ramen's CephFS CG ReplicationGroupSource test-appset-deploy-cephfs-rook-cephfs-fs1-dr1-1 keeps creating VolumeGroupSnapshots. CephFS CSI CreateGroupSnapshot fails repeatedly with rpc error: code = Internal desc = Quiesce operation is in progress. VGS stays readyToUse: false. |
| 07:37:01 | RGS tries to restore the VGS → can't restore volume group snapshot: volume group snapshot is not ready to be used |
| 07:37:02 | Unprotect: DRPC deleted, VRG deletion starts. VRG deletes member VolumeSnapshot snapshot-eed7… and deletes the RGS. RGS controller logs VRG is deleted, skipping RGS reconciliation. |
| 07:37:05 | VGS (controller-owned by the RGS) is garbage-collected; snapshot-controller deletes the VGS and issues DELETE for the member snapshot |
| 07:41:05 | snapshot-controller retries member snapshot: still Completed: false; group content already not found → finalizer never cleared |
| 07:42:32 | Namespace deletion times out |
Evidence
Workload namespace is stuck:
# dr1/cluster/namespaces/test-appset-deploy-cephfs.yaml
status:
phase: Terminating
conditions:
- message: 'Some resources are remaining: volumesnapshots.snapshot.storage.k8s.io has 1 resource instances'
reason: SomeResourcesRemain
type: NamespaceContentRemaining
- message: 'Some content in the namespace has finalizers remaining:
snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection in 1 resource instances'
reason: SomeFinalizersRemain
type: NamespaceFinalizersRemaining
The leftover object:
# dr1/namespaces/test-appset-deploy-cephfs/snapshot.storage.k8s.io/volumesnapshots/snapshot-eed7….yaml
kind: VolumeSnapshot
metadata:
deletionTimestamp: "2026-11-18T07:37:02Z"
finalizers:
- snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection
ownerReferences:
- apiVersion: groupsnapshot.storage.k8s.io/v1
kind: VolumeGroupSnapshot
name: test-appset-deploy-cephfs-rook-cephfs-fs1-dr1-1
status:
readyToUse: false
boundVolumeSnapshotContentName: snapcontent-eed7…CephFS CSI (csi-snapshotter) repeatedly:
createGroupSnapshotWrapper: CreateGroupSnapshot for groupSnapshotContent groupsnapcontent-f162ba88-… returned error:
rpc error: code = Internal desc = Quiesce operation is in progress
snapshot-controller deleting the VGS / member snapshot:
processGroupSnapshotWithDeletionTimestamp[...]: Delete individual snapshots that are part of the group snapshot
...
Removed protection finalizer from volume group snapshot ...
group snapshot ... deleted
deleteGroupSnapshot: scheduling sync of group snapshot content groupsnapcontent-f162ba88-…
deletion of group snapshot content "groupsnapcontent-f162ba88-…" was already processed
...
synchronizing VolumeSnapshot[snapshot-eed7…]: bound to: "snapcontent-eed7…", Completed: false
Ramen operator:
rgs ... Failed to restore volume group snapshot: can't restore volume group snapshot: volume group snapshot is not ready to be used
rgs ... VRG is deleted, skipping RGS reconciliation
vrg ... Deleted VolumeSnapshot name=snapshot-eed7…
Root cause
ReplicationGroupSource(RGS) is set as controller owner of theVolumeGroupSnapshot(cephfscg/volumegroupsourcehandler.go,CreateOrUpdateVolumeGroupSnapshot→ctrl.SetControllerReference(owner, volumeGroupSnapshot, ...)). Deleting the RGS cascades to the VGS and its memberVolumeSnapshot.- On VRG deletion,
vrg_volsync.go:doCleanupResourcesdeletes the RGS viacephfscg.DeleteRGS, but does not run the RGS cleanup/CleanVolumeGroupSnapshotpath or wait for the VGS/member snapshots to be fully removed before finalizing the VRG. ReplicationGroupSourceReconciler.getRGSConfigearly-returns when the owning VRG is deleted:This skipsif util.ResourceIsDeleted(vrg) { logger.Info("VRG is deleted, skipping RGS reconciliation", ...) return nil, nil, nil, true, nil }
ReplicationGroupSourceMachine.Cleanup()→CleanVolumeGroupSnapshot(). Cleanup is therefore left entirely to Kubernetes GC + external-snapshotter.- The group snapshot never completed (
readyToUse: false). When the VGS/group content was deleted, external-snapshotter could not finish cleaning the memberVolumeSnapshot, so thevolumesnapshot-in-group-protectionfinalizer was orphaned. The namespace can no longer be deleted.
Impact
- Any CephFS CG workload whose VRG is unprotected/deleted while a group snapshot is in flight (not ready) can leave the workload namespace stuck in
Terminating. - This can make DR relocation/failover followed by unprotect/undeploy hang, as seen in e2e.
Suggested fixes
- On VRG deletion, do not skip the RGS cleanup solely because the VRG is being deleted. Explicitly delete the
VolumeGroupSnapshot(and member snapshots/restored PVCs) and wait for their finalizers to clear before completing VRG finalization. - Ensure
CleanVolumeGroupSnapshothandles the "VGS not ready" case and member-snapshot finalizers, rather than relying on cascade GC. - Guard against creating/updating a new VGS once the VRG/RGS is being deleted.
- Back off/avoid overlapping VGS create attempts when CSI reports
Quiesce operation is in progress. - Add an e2e/regression test: CephFS CG + failover/relocate + unprotect while a group snapshot is in progress; assert the namespace deletes.
Notes
- The e2e failure is a race (VGS created 07:37:01, teardown started 07:37:02) and may pass on retry, but the cleanup gap is real.
- Must-gather evidence is in the run artifact above (
test/gather.rdr/dr1,e2e/dr.log).
Metadata
Metadata
Assignees
Labels
discovered-by-testDiscovered/reported by the test team
Activity
cephfscg: Clean up CephFS group snapshots when a VRG is deleted
cephfscg: Delete not-ready group snapshots and their members
cephfscg: Hold the ReplicationGroupSource until group snapshot cleanu…
cephfscg: Add envtest coverage for group snapshot deletion
cephfscg: Delete not-ready group snapshots and their members
cephfscg: Hold the ReplicationGroupSource until group snapshot cleanu…
cephfscg: Add envtest coverage for group snapshot deletion
cephfscg: Delete not-ready group snapshots and their members
cephfscg: Hold the ReplicationGroupSource until group snapshot cleanu…
cephfscg: Add envtest coverage for group snapshot deletion
cephfscg: Delete not-ready group snapshots and their members
cephfscg: Hold the ReplicationGroupSource until group snapshot cleanu…
cephfscg: Add envtest coverage for group snapshot deletion