Skip to content

fix(datavolume): update default api_name to "storage" and clarify usage - #2886

Open
ema-aka-young wants to merge 1 commit into
RedHatQE:mainfrom
ema-aka-young:CNV-79539-storage-default-v2
Open

ema-aka-young wants to merge 1 commit into
RedHatQE:mainfrom
ema-aka-young:CNV-79539-storage-default-v2

Conversation

@ema-aka-young

@ema-aka-young ema-aka-young commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Short description:

Default DataVolume.api_name to "storage".

More details:

Remove the transition warning and update the examples. Explicit "pvc" selects spec.pvc, and explicit None omits the target section.

What this PR does / why we need it:

Aligns the wrapper with CDI’s recommended storage API, which supports StorageProfile defaults and filesystem-overhead sizing. CDI documentation

Which issue(s) this PR fixes:

CNV-79539

Special notes for reviewer:

This is a breaking change, but the deprecation warning is there since two versions.

Bug:

Omitting api_name currently selects spec.pvc, bypassing CDI’s spec.storage defaults.

Summary by CodeRabbit

  • New Features
    • DataVolume resources now use spec.storage by default. To use spec.pvc, specify api_name="pvc".
    • Passing None leaves the target spec section unset.
  • Documentation
    • Updated the DataVolume guidance to reflect the default and available options.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The DataVolume constructor now defaults api_name to storage. Passing None omits the target spec section without a warning or substitution. The documentation examples and guidance reflect these behaviors.

Changes

DataVolume default section

Layer / File(s) Summary
Constructor behavior and examples
ocp_resources/datavolume.py, docs/common-patterns.md
The constructor defaults api_name to storage and stores the supplied value directly. Passing None omits the target section. The documentation describes the default and shows pvc as an option.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: myakove, dalia-frank, rnetser

Merge Risk: Minimal · up to 42163

The default DataVolume spec section changes from pvc to storage, as the PR intends. Callers that relied on the old default must pass api_name="pvc". No further merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change, which sets the DataVolume api_name default to "storage" in ocp_resources/datavolume.py. It also names the documentation clarification. The title matches the changeset,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description fills in the Short description, More details, What this PR does, Which issue(s) it fixes, and Bug sections, but it leaves Special notes for reviewer partly unclear. It states the chang…
Full details: Title check

Explanation

The title names the main change, which sets the DataVolume api_name default to "storage" in ocp_resources/datavolume.py. It also names the documentation clarification. The title matches the changeset, and the conventional-commit prefix is acceptable.

Full details: Description check

Explanation

The description fills in the Short description, More details, What this PR does, Which issue(s) it fixes, and Bug sections, but it leaves Special notes for reviewer partly unclear. It states the change is breaking and that a deprecation warning has existed for two versions, which covers the key reviewer context. The description is specific: it names the new default, the explicit "pvc" and None behaviors, the linked CDI documentation, and the issue CNV-79539. The template has no required field that is missing. The description is mostly complete, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bcb97e8 and 4216388.

Files selected for processing: 2

  • docs/common-patterns.md
  • ocp_resources/datavolume.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@redhat-qe-bot

Copy link
Copy Markdown
Contributor

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (effective maintainers and approvers only)
  • /automerge cancel - Remove automerge label (effective maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest python-module-install - Test Python package installation
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • rnetser

Reviewers:

  • myakove
  • rnetser
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (EnMaaS/rits/deepseek-ai/DeepSeek-V4.1-Flash-1017)
  • Cherry-Pick Conflict Resolution: Enabled (EnMaaS/rits/deepseek-ai/DeepSeek-V4.1-Flash-1017)
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@qodo-code-review

qodo-code-review Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Default DataVolume target to spec.storage

🐞 Bug fix 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Default DataVolumes to spec.storage so CDI can apply StorageProfile defaults and
 filesystem-overhead sizing.
• Preserve spec.pvc through explicit api_name="pvc" and omit the target section with explicit None.
• Remove the transition warning and update examples to reflect the new default.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed fields determine the target section and storage properties of one end-to-end DataVolume provisioning behavior.
  • The serializer is the changed implementation point; no separate repository capability or independent functional scope was found in inspected consumers.
Sources

ocp_resources/datavolume.py[151-151]

        self.api_name = api_name

ocp_resources/datavolume.py[98-98]

        api_name: str | None = "storage",
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, omitted api_name selected the legacy PVC target through a None fallback and emitted the same storage properties there.
  • After, omission selects storage, while explicit None skips the target section.
  • The changed correctness condition is selecting the intended target key before applying the existing direct property mapping; no new algorithm, concurrency, state protocol, or interacting branch structure is introduced.
Sources

ocp_resources/datavolume.py[98-98]

        api_name: str | None = "storage",

ocp_resources/datavolume.py[127-128]

            api_name (str | None, default: "storage"): Target section of the DataVolume spec ("storage" or "pvc").
                Pass None to omit the target section.

ocp_resources/datavolume.py[151-151]

        self.api_name = api_name

ocp_resources/datavolume.py[178-191]

            if self.api_name is not None:
                _spec[self.api_name] = {}

                if self.access_modes is not None:
                    _spec[self.api_name]["accessModes"] = [self.access_modes]

                if self.volume_mode is not None:
                    _spec[self.api_name]["volumeMode"] = self.volume_mode

                if self.storage_class is not None:
                    _spec[self.api_name]["storageClassName"] = self.storage_class

                if self.size is not None:
                    _spec[self.api_name]["resources"] = {"requests": {"storage": self.size}}
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the selected target section is incompatible with a caller's CDI/API expectations, DataVolume creation or provisioning can fail.
  • This assessment is conditional; the inspected source does not establish a concrete fault in the new storage mapping.
  • A code revert restores the prior constructor behavior for future manifests, while any already submitted failed request must be retried.
  • Reverting the library restores future manifest generation; failed DataVolume creation requires retry, but no persistent-data repair or external compensation is supported by the inspected source.
Sources

ocp_resources/datavolume.py[98-98]

        api_name: str | None = "storage",

ocp_resources/datavolume.py[127-128]

            api_name (str | None, default: "storage"): Target section of the DataVolume spec ("storage" or "pvc").
                Pass None to omit the target section.

ocp_resources/datavolume.py[178-191]

            if self.api_name is not None:
                _spec[self.api_name] = {}

                if self.access_modes is not None:
                    _spec[self.api_name]["accessModes"] = [self.access_modes]

                if self.volume_mode is not None:
                    _spec[self.api_name]["volumeMode"] = self.volume_mode

                if self.storage_class is not None:
                    _spec[self.api_name]["storageClassName"] = self.storage_class

                if self.size is not None:
                    _spec[self.api_name]["resources"] = {"requests": {"storage": self.size}}
Assessed commit 4216388
Diagram

graph TD
  DV["DataVolume constructor"] --> Choice{"api_name value"} -->|"default storage"| Storage["spec.storage"]
  Choice -->|"explicit pvc"| PVC["spec.pvc"]
  Choice -->|"explicit None"| Omit["No target section"]
Loading
High-Level Assessment

Changing the constructor default is the direct way to align generated DataVolumes with CDI while retaining explicit pvc and None behavior. A separate migration mechanism would add complexity after the existing warning period; regression tests for all three cases would strengthen this approach.

Files changed (2) +6 / -17

Bug fix (1) +4 / -14
datavolume.pyDefault DataVolume api_name to storage +4/-14

Default DataVolume api_name to storage

• Changes the constructor default from None to "storage" and removes the fallback to pvc and its FutureWarning. The docstring clarifies that explicit None omits the target section; existing serialization handles that case.

ocp_resources/datavolume.py

Documentation (1) +2 / -3
common-patterns.mdShow spec.storage as the DataVolume default +2/-3

Show spec.storage as the DataVolume default

• Removes redundant api_name="storage" arguments from import and clone examples. Replaces the future-change warning with guidance for selecting spec.pvc explicitly.

docs/common-patterns.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants