Skip to content

Remove DataSource storage class fallback from DV template helper#4985

Merged
rnetser merged 1 commit into
RedHatQE:mainfrom
RoniKishner:dv-template-snapshot
Jun 3, 2026
Merged

Remove DataSource storage class fallback from DV template helper#4985
rnetser merged 1 commit into
RedHatQE:mainfrom
RoniKishner:dv-template-snapshot

Conversation

@RoniKishner

@RoniKishner RoniKishner commented May 25, 2026

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

When calling data_volume_template_with_source_ref_dict we should either use it with explicit storage_class field, or omit the field and use the default storage class.
Relying on the storage class of the DataSources can cause miss interpretations, while also causing issues since it is not possible to match the storage class to the DataSource, if a snap shot storage class is used.

Which issue(s) this PR fixes:

Failing tests when snapshot storage classes are set.

Special notes for reviewer:

Since we could not decide the storage class according to the VolumeSnapshot that was used when creating the VM, this is the approach we decided to use.

jira-ticket:

https://redhat.atlassian.net/browse/CNV-88988

Summary by CodeRabbit

  • Bug Fixes

    • Data volumes now use only an explicitly provided storage class and no longer inherit or default from referenced sources, preventing unexpected storage-class selection.
  • Tests

    • Test suite updated to validate scoped storage-class selection; test fixtures adjusted to consistently provide the chosen storage class across scopes.

@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@RoniKishner, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 32 minutes and 4 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 05ef4e18-7f5b-439c-a908-7cd27a66166e

📥 Commits

Reviewing files that changed from the base of the PR and between 59233f8 and 2135565.

📒 Files selected for processing (4)
  • tests/conftest.py
  • tests/infrastructure/golden_images/test_common_templates_data_volumes.py
  • tests/storage/conftest.py
  • utilities/storage.py
📝 Walkthrough

Walkthrough

data_volume_template_with_source_ref_dict now sets the DataVolume's storage_class only from its storage_class parameter (no fallback). The vm_from_golden_image_multi_storage test fixture was updated to accept storage_class_name_scope_function and pass it into the template call.

Changes

Storage class passthrough and test wiring

Layer / File(s) Summary
DataVolume storage_class passthrough
utilities/storage.py
data_volume_template_with_source_ref_dict stops deriving storage_class from the referenced DataSource and uses only the provided storage_class argument.
Fixture adds and wires scoped storage_class
tests/conftest.py, tests/infrastructure/golden_images/test_common_templates_data_volumes.py, tests/storage/conftest.py
Adds storage_class_name_scope_function fixture, removes the duplicate fixture from tests/storage/conftest.py, and updates vm_from_golden_image_multi_storage to accept and pass storage_class_name_scope_function as storage_class into data_volume_template_with_source_ref_dict.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • kgoldbla
  • geetikakay
  • dshchedr
  • rnetser
  • josemacassan
  • dalia-frank
  • Ahmad-Hafe
  • kshvaika
  • ema-aka-young
  • vsibirsk

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Stp Link Required ❌ Error Newly added test file tests/infrastructure/golden_images/test_common_templates_data_volumes.py contains 3 test functions but lacks required STP/RFE/Jira links in docstrings. Add STP/RFE/Jira link to module, class, or test function docstring. @pytest.mark.polarion alone is insufficient.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: removing the fallback behavior that used DataSource storage classes in the data volume template helper.
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 PR description provides clear context about changes, fixes, and special considerations. All required template sections are completed with meaningful content.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@openshift-virtualization-qe-bot-5

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

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

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
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • RoniKishner
  • dshchedr
  • geetikakay
  • mijankow
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 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.

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (a2dc143) to head (2135565).
⚠️ Report is 77 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4985      +/-   ##
==========================================
- Coverage   98.67%   98.65%   -0.02%     
==========================================
  Files          25       25              
  Lines        2487     2456      -31     
==========================================
- Hits         2454     2423      -31     
  Misses         33       33              
Flag Coverage Δ
utilities 98.65% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread utilities/storage.py Outdated
@openshift-virtualization-qe-bot-4

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (d211ddc).
The following labels were preserved: changes-requested-jpeimer, commented-RoniKishner.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get latest commit SHA
gh pr view 4985 --repo RedHatQE/openshift-virtualization-tests --json headRefOid -q '.headRefOid'

echo "=== Gating-marked test files ==="
rg -l '`@pytest.mark.gating`' tests/ 2>/dev/null || echo "None found"

echo "=== Gating tests that use data_volume_template_with_source_ref_dict ==="
rg -l 'data_volume_template_with_source_ref_dict' tests/ 2>/dev/null | xargs -I{} grep -l 'gating' {} 2>/dev/null || echo "None found"

echo "=== Smoke-marked test files ==="
rg -l '`@pytest.mark.smoke`' tests/ 2>/dev/null | head -20 || echo "None found"

echo "=== All callers of data_volume_template_with_source_ref_dict in tests/ ==="
rg -n 'data_volume_template_with_source_ref_dict' tests/ --type py -l

echo "=== All callers of data_volume_template_with_source_ref_dict in utilities/ ==="
rg -n 'data_volume_template_with_source_ref_dict' utilities/ --type py

echo "=== storage_class_name_scope_function callers ==="
rg -n 'storage_class_name_scope_function' tests/ --type py

echo "=== Check if any gating tests use storage_class_name_scope_function ==="
rg -l 'storage_class_name_scope_function' tests/ --type py | xargs -I{} grep -l 'gating' {} 2>/dev/null || echo "None"

echo "=== Check smoke tests that have data_volume or golden_image in path ==="
rg -l '`@pytest.mark.smoke`' tests/infrastructure/golden_images/ 2>/dev/null || echo "None"
rg -l '`@pytest.mark.smoke`' tests/virt/upgrade/ 2>/dev/null || echo "None"

Length of output: 10369


🏁 Script executed:

#!/bin/bash
COMMIT_SHA="2135565c9051fc6a828f2711d019fc06285d57ac"

gh api \
  --method POST \
  -H "Accept: application/vnd.github+json" \
  /repos/RedHatQE/openshift-virtualization-tests/pulls/4985/comments \
  -f commit_id="$COMMIT_SHA" \
  -f path="tests/infrastructure/golden_images/test_common_templates_data_volumes.py" \
  -f side="RIGHT" \
  -F line=22 \
  -f body="**Test Execution Plan**

- **Run smoke tests: True**
  - \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke) → \`tests/storage/conftest.py\`\`data_volume_template_with_source_ref_dict\` (modified)
  - \`tests/storage/cdi_clone/test_clone.py\` (smoke) → \`tests/storage/conftest.py\`\`data_volume_template_with_source_ref_dict\` (modified)
  - \`tests/infrastructure/instance_types/supported_os/test_rhel_os.py\` (smoke) → \`tests/infrastructure/instance_types/conftest.py\`\`data_volume_template_with_source_ref_dict\` (modified)

- **Run gating tests: True**
  - \`tests/virt/upgrade/test_upgrade_virt.py\` (gating) → \`tests/virt/upgrade/conftest.py\`\`data_volume_template_with_source_ref_dict\` (modified, no \`storage_class\` passed → now uses cluster default instead of DataSource's SC)

**Directly affected tests:**
- \`tests/infrastructure/golden_images/test_common_templates_data_volumes.py::test_vm_from_golden_image_cluster_default_storage_class\`
- \`tests/infrastructure/golden_images/test_common_templates_data_volumes.py::test_vm_from_golden_image_different_storage_class\`

**Callers omitting \`storage_class\` (now default to cluster default instead of DataSource's SC):**
- \`tests/virt/upgrade/\` — via \`tests/virt/upgrade/conftest.py\`
- \`tests/infrastructure/golden_images/update_boot_source/test_boot_sources_vm.py\` — via \`tests/infrastructure/golden_images/update_boot_source/conftest.py\`
- \`tests/infrastructure/golden_images/update_boot_source/test_ssp_data_import_crons.py\`

**\`storage_class_name_scope_function\` fixture moved** (tests/storage/conftest.py → tests/conftest.py, same behavior):
- \`tests/storage/golden_image/test_golden_image.py\` (gating)
- \`tests/storage/cdi_upload/test_upload_virtctl.py\` (smoke, gating)
- \`tests/storage/general/test_storage_behavior.py\`
- \`tests/storage/test_data_import_cron.py\`" \
  --jq '.id'

Length of output: 2324



@jpeimer

jpeimer commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@RoniKishner

Copy link
Copy Markdown
Contributor Author

Verified gating as well.

@geetikakay

Copy link
Copy Markdown
Contributor

/lgtm

@rnetser

rnetser commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

/approve
/lgtm

@openshift-virtualization-qe-bot-2

Copy link
Copy Markdown
Contributor

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

@RoniKishner

Copy link
Copy Markdown
Contributor Author

/cherry-pick cnv-4.22

@openshift-virtualization-qe-bot

Copy link
Copy Markdown

Cherry-picked PR Remove DataSource storage class fallback from DV template helper into cnv-4.22: #5140

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.

9 participants