rbd: skip flatten for ROX snapshot restores - #6534
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core RBD snapshot-restore behavior in the CSI controller (flattening semantics), which can have broad functional impact and should be validated by a maintainer with real-world upgrade/backup workflows in mind.
Pull request overview
This PR updates the RBD CSI controller snapshot-restore path to preserve deep clone chains for read-only (ROX) restores by skipping parent flattening, enabling tools like rbd diff to leverage the parent chain for incremental backup workflows. It also extends the RBD E2E coverage to assert ROX retention behavior while keeping existing RW restore flattening behavior.
Changes:
- Skip
flattenParentImage()duringCreateVolumewhen restoring from a snapshot with exclusively reader-only capabilities. - Add
AreAllCapabilitiesReaderOnly()helper (with unit tests) to distinguish “all-RO” requests from mixed capability sets. - Extend the “trashed parents + clone depth” RBD E2E to verify ROX restore retains the parent chain and RW restore still triggers flattening (and label it for acceptance).
File summaries
| File | Description |
|---|---|
| internal/rbd/controllerserver.go | Skips snapshot-parent flattening for ROX snapshot restores while preserving existing behavior for RW restores. |
| internal/csi-common/utils.go | Adds AreAllCapabilitiesReaderOnly() to detect exclusively reader-only capability sets. |
| internal/csi-common/utils_test.go | Adds unit tests for the new AreAllCapabilitiesReaderOnly() helper. |
| e2e/rbd.go | Updates/renames the clone-depth test and adds acceptance label. |
| e2e/rbd_helper.go | Refactors parent-detection logic and adds ensureRBDImageHasParent() plus getRBDImageParent() helper. |
| e2e/rbd_clone_depth.go | Extends the trashed-parent clone-depth scenario to cover ROX retention and RW flattening expectations. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
917177d to
9e38256
Compare
9e38256 to
3cd412a
Compare
3890922 to
d1d5bbb
Compare
3c85645 to
ad22352
Compare
ad22352 to
3617669
Compare
|
Wait for #6490 to be merged before adding |
Merge Protections🟢 All 2 merge protections satisfied — ready to merge. Show 2 satisfied protections🟢 ⛓️ Depends-On RequirementsRequirement based on the presence of
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
|
/queue |
|
@Mergifyio rebase |
🛑 The pull request rule doesn't match anymoreDetailsThis action has been cancelled. |
Avoid flattening snapshot parents when restoring read-only volumes so deep clone chains remain intact. Extend the trashed-parent E2E to verify ROX retention and RW flattening. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Rakshith R <rar@redhat.com>
3617669 to
144534c
Compare
|
/test ci/centos/upgrade-tests-cephfs |
|
/test ci/centos/k8s-e2e-external-storage/1.36 |
|
/test ci/centos/k8s-e2e-external-storage/1.34 |
|
/test ci/centos/k8s-e2e-external-storage/1.35 |
|
/test ci/centos/upgrade-tests-rbd |
|
/test ci/centos/mini-e2e-helm/k8s-1.36 |
|
/test ci/centos/mini-e2e-helm/k8s-1.34 |
|
/test ci/centos/mini-e2e-helm/k8s-1.35 |
|
/test ci/centos/mini-e2e/k8s-1.36 |
|
/test ci/centos/mini-e2e/k8s-1.34 |
|
/test ci/centos/mini-e2e/k8s-1.35 |
|
/retest ci/centos/mini-e2e/k8s-1.34 |
|
Deprecation notice: This pull request comes from a fork and was queued with |
Merge Queue Status
This pull request spent 11 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
Summary
Preserve the RBD parent chain when restoring snapshots as read-only volumes. This allows rbd diff changed-block tracking to work for incremental backups.
CreateVolume passes the all-capabilities reader-only state to flattenParentImage. ROX snapshot restores return before flattening, while RW and mixed-capability restores retain the existing flattening behavior.
The clone-depth acceptance coverage now verifies both behaviors with trashed parents: ROX restores retain a parent, and RW restores flatten the image.
Validation
Assisted-by: Claude Code noreply@anthropic.com
CI resource ordering.
Depends-on: #6490