Skip to content

[Storage] Use source_dict for DataVolume source specification, refactor create_dv#5443

Merged
rnetser merged 9 commits into
RedHatQE:mainfrom
jpeimer:add_dv_source_dict
Jul 6, 2026
Merged

[Storage] Use source_dict for DataVolume source specification, refactor create_dv#5443
rnetser merged 9 commits into
RedHatQE:mainfrom
jpeimer:add_dv_source_dict

Conversation

@jpeimer

@jpeimer jpeimer commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
What this PR does / why we need it:

DataVolume source argument is deprecated and needs to be replaced by the source_dict

Refactor create_dv and all DataVolume instantiations to use source_dict=
with construct_datavolume_source_dict() instead of the legacy source=.

Why: The old create_dv interface mixed source specification, artifactory
lifecycle, and annotation handling into a single flat parameter list. This made
it unclear which parameters applied to which source types and coupled every
caller to artifactory internals.

Changes:

  • Extract construct_datavolume_source_dict() as a pure function for building
    DataVolume source dicts from typed parameters (http, registry, pvc, blank, upload)
  • Refactor create_dv to accept source_dict= directly, own artifactory
    lifecycle in try/finally, use generic annotations dict instead of
    multus_annotation/bind_immediate, and add full type hints
  • Rename parameters for consistency: secretsecret_name,
    cert_configmapcert_configmap_name, source_pvcsource_pvc_name,
    source_namespacesource_pvc_namespace
  • Remove unused hostpath_node parameter
  • Migrate all 36 caller files to the new interface
Which issue(s) this PR fixes:
Special notes for reviewer:
  • The two commits are stacked: first refactors create_dv and updates callers
    using create_dv, second migrates direct DataVolume() instantiations to
    use construct_datavolume_source_dict()
  • No behavioral changes — all callers produce the same DataVolume specs as before
  • This change is needed as preparation for specifying the architecture in DV spec.
jira-ticket:

Summary by CodeRabbit

  • New Features
    • Added a shared helper to standardize DataVolume source setup for HTTP, registry, blank, PVC, and upload scenarios.
    • Standardized bind-immediate behavior using DataVolume annotations.
  • Bug Fixes
    • Corrected TLS/auth wiring by consistently using named secret and cert config-map references.
    • Improved Artifactory-backed image handling by enabling Artifactory mode where applicable.
    • Updated source PVC identification to use explicit name/namespace fields.
  • Tests
    • Refreshed many fixtures and helpers to use the unified source_dict flow and new parameter names.
    • Added unit tests validating the new source configuration helper, including URL validation behavior.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f786c6f1-7a24-49fa-8f9a-ce72b667a362

📥 Commits

Reviewing files that changed from the base of the PR and between 6436367 and 67dc47d.

📒 Files selected for processing (1)
  • utilities/unittests/test_storage.py
💤 Files with no reviewable changes (1)
  • utilities/unittests/test_storage.py
📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
  • GitHub Check: can-be-merged
⚠️ CI failures not shown inline (5)

GitHub Check: can-be-merged: Check if can be merged

Conclusion: failure

View job details

Some check runs not started: cnv-smoke/validation, verified, verify-bugs-are-open, security-committer-identity, security-suspicious-paths, build-container, tox
Missing required labels: tox:verify-tc-requirement-polarion:passed
PR has 1 unresolved review conversation(s):
  - utilities/unittests/test_storage.py:None (outdated) (https://github.com/RedHatQE/openshift-virtualization-tests/pull/5443#discussion_r3524762715)
Missing approved from approvers: jpeimer, rnetser, dshchedr, myakove, vsibirsk
Missing lgtm from reviewers. Minimum 2 required, (0 given). Reviewers: kshvaika, dalia-frank, SamAlber, Ahmad-Hafe, hmeir, ema-aka-young, rlobillo, kgoldbla, Acedus, awels, guchen11, akri3i, vsibirsk, akalenyu, Dsanatar, acinko-rh, geetikakay, albarker-rh, dshchedr, sarahbx, OhadRevah, RoniKishner, mijankow, rnetser, myakove, josemacassan.

GitHub Check: can-be-merged: Check if can be merged

Conclusion: failure

View job details

Some check runs not started: verified, cnv-smoke/validation, tox, build-container, verify-bugs-are-open, security-suspicious-paths, security-committer-identity
PR has 1 unresolved review conversation(s):
  - utilities/unittests/test_storage.py:None (outdated) (https://github.com/RedHatQE/openshift-virtualization-tests/pull/5443#discussion_r3524762715)
Missing approved from approvers: myakove, rnetser, dshchedr, jpeimer, vsibirsk
Missing lgtm from reviewers. Minimum 2 required, (1 given). Reviewers: Ahmad-Hafe, hmeir, myakove, rlobillo, guchen11, awels, vsibirsk, acinko-rh, josemacassan, geetikakay, dalia-frank, RoniKishner, albarker-rh, ema-aka-young, akri3i, Dsanatar, sarahbx, Acedus, dshchedr, kshvaika, OhadRevah, kgoldbla, rnetser, mijankow, akalenyu, SamAlber.

GitHub Check: can-be-merged: Check if can be merged

Conclusion: failure

View job details

Some check runs not started: build-container, cnv-smoke/validation, security-committer-identity, verified, tox, verify-bugs-are-open, security-suspicious-paths
PR has 1 unresolved review conversation(s):
  - utilities/unittests/test_storage.py:None (outdated) (https://github.com/RedHatQE/openshift-virtualization-tests/pull/5443#discussion_r3524762715)
Missing approved from approvers: vsibirsk, myakove, rnetser, dshchedr, jpeimer
Missing lgtm from reviewers. Minimum 2 required, (1 given). Reviewers: geetikakay, myakove, guchen11, ema-aka-young, SamAlber, sarahbx, Acedus, rnetser, acinko-rh, dshchedr, josemacassan, albarker-rh, dalia-frank, akri3i, rlobillo, mijankow, kgoldbla, OhadRevah, Dsanatar, vsibirsk, hmeir, Ahmad-Hafe, kshvaika, awels, RoniKishner, akalenyu.

GitHub Check: can-be-merged: Check if can be merged

Conclusion: failure

View job details

Some check runs not started: security-committer-identity, verified, build-container, cnv-smoke/validation, tox, security-suspicious-paths, verify-bugs-are-open
PR has 1 unresolved review conversation(s):
  - utilities/unittests/test_storage.py:None (outdated) (https://github.com/RedHatQE/openshift-virtualization-tests/pull/5443#discussion_r3524762715)
Missing approved from approvers: rnetser, vsibirsk, myakove, dshchedr, jpeimer
Missing lgtm from reviewers. Minimum 2 required, (1 given). Reviewers: rnetser, akri3i, ema-aka-young, guchen11, vsibirsk, kshvaika, hmeir, awels, sarahbx, SamAlber, myakove, acinko-rh, Acedus, josemacassan, dshchedr, kgoldbla, Dsanatar, akalenyu, rlobillo, Ahmad-Hafe, geetikakay, mijankow, OhadRevah, albarker-rh, dalia-frank, RoniKishner.

GitHub Check: can-be-merged: Check if can be merged

Conclusion: failure

View job details

Some check runs not started: security-suspicious-paths, verify-bugs-are-open, cnv-smoke/validation, build-container, tox, security-committer-identity, verified, pre-commit.ci - pr
PR has 1 unresolved review conversation(s):
  - utilities/unittests/test_storage.py:None (outdated) (https://github.com/RedHatQE/openshift-virtualization-tests/pull/5443#discussion_r3524762715)
Missing approved from approvers: vsibirsk, rnetser, jpeimer, dshchedr, myakove
Missing lgtm from reviewers. Minimum 2 required, (1 given). Reviewers: rlobillo, sarahbx, vsibirsk, kgoldbla, guchen11, acinko-rh, SamAlber, albarker-rh, dshchedr, ema-aka-young, josemacassan, Ahmad-Hafe, rnetser, myakove, Dsanatar, RoniKishner, awels, dalia-frank, geetikakay, akalenyu, OhadRevah, hmeir, akri3i, kshvaika, mijankow, Acedus.

📝 Walkthrough

Walkthrough

Adds unit tests for construct_datavolume_source_dict covering HTTP, registry, PVC, blank, upload, and invalid source inputs, including URL-validation branching for HTTP.

Changes

Storage helper coverage

Layer / File(s) Summary
HTTP and registry cases
utilities/unittests/test_storage.py
construct_datavolume_source_dict is imported through real-module setup, and HTTP/registry outputs are verified for plain URLs, optional secret/config-map inputs, and HTTP URL-validation behavior.
PVC, blank, and upload cases
utilities/unittests/test_storage.py
PVC output is checked with and without namespace, and blank/upload sources are asserted to produce empty source dictionaries.
Unsupported source case
utilities/unittests/test_storage.py
An unsupported source type is asserted to raise ValueError with the expected message.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: new-tests

Suggested reviewers: Acedus, acinko-rh, dalia-frank, ema-aka-young, josemacassan, kshvaika, RoniKishner

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is under 120 characters and clearly summarizes the source_dict refactor and create_dv update.
Description check ✅ Passed All required sections are present and the PR purpose, scope, and reviewer notes are clearly described.
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.
Stp Link Required ✅ Passed PASS: The PR adds no new tests/**/test_*.py files and no new test_* functions in existing test files; the only new test file is under utilities/unittests/, which is excluded.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped RedHatQE/openshift-virtualization-tests-design-docs.


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

Comment @coderabbitai help to get the list of available commands.

@openshift-virtualization-qe-bot-6

Copy link
Copy Markdown

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: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • 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: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 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 (approvers only)
  • /hold cancel - Unblock PR merging
  • /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)
  • /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 build-container - Rebuild and test container image
  • /retest verify-bugs-are-open - verify-bugs-are-open
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

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

Custom Commands

  • /test-plan - Triggers CodeRabbit to analyze the PR's changed files and post a test execution plan
  • /rerun-smoke - Adds `retest-smoke` label on the PR to trigger smoke tests exectuion

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. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • dshchedr
  • jpeimer
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Acedus
  • Ahmad-Hafe
  • Dsanatar
  • OhadRevah
  • RoniKishner
  • SamAlber
  • acinko-rh
  • akalenyu
  • akri3i
  • albarker-rh
  • awels
  • dalia-frank
  • dshchedr
  • ema-aka-young
  • geetikakay
  • guchen11
  • hmeir
  • josemacassan
  • jpeimer
  • kgoldbla
  • kshvaika
  • mijankow
  • rlobillo
  • rnetser
  • sarahbx
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6-1m)
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
  • Container Builds: Container images are automatically tagged with the PR number
  • 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.

@rnetser

rnetser commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@openshift-virtualization-qe-bot-6

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (67dc47d).
The following labels were preserved: verified, commented-jpeimer, lgtm-coderabbitai[bot].

@jpeimer

jpeimer commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

/verified
(just a rebase)

@josemacassan

Copy link
Copy Markdown
Contributor

/lgtm

2 similar comments
@Ahmad-Hafe

Copy link
Copy Markdown
Contributor

/lgtm

@vsibirsk

vsibirsk commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

/lgtm

@jpeimer

jpeimer commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-smoke

@openshift-virtualization-qe-bot-6

Copy link
Copy Markdown

Successfully removed PR tag: quay.io/openshift-cnv/openshift-virtualization-tests:pr-5443.

@jpeimer

jpeimer commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/cherry-pick cnv-4.22

@openshift-virtualization-qe-bot-4

Copy link
Copy Markdown

Manual cherry-pick is needed
Cherry pick failed for b315c12 to cnv-4.22:
To cherry-pick run:

git remote update
git checkout cnv-4.22
git pull origin cnv-4.22
git checkout -b add_dv_source_dict-cnv-4.22
git cherry-pick b315c12830d0d1240b2159d4748088b87d9bce84
# If the above fails with 'is a merge but no -m option', run:
# git cherry-pick -m 1 b315c12830d0d1240b2159d4748088b87d9bce84
git push origin add_dv_source_dict-cnv-4.22

@openshift-virtualization-qe-bot-6

Copy link
Copy Markdown

New container for quay.io/openshift-cnv/openshift-virtualization-tests:latest published

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.