WIP: [Mian][T2] fix test_clone_from_block_to_fs_using_dv_template #3366
WIP: [Mian][T2] fix test_clone_from_block_to_fs_using_dv_template #3366Ahmad-Hafe wants to merge 1 commit intoRedHatQE:mainfrom
Conversation
📝 WalkthroughWalkthroughCentralizes get_storage_profile_minimum_supported_pvc_size into Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
c0cadb8 to
262c3a7
Compare
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/wip cancel |
|
/verified all impacted tests: test_clone_from_block_to_fs_using_dv_template psi cluster 4.21 |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Test Execution Plan
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 40 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 192 🏁 Script executed: Length of output: 180 🏁 Script executed: Length of output: 224 🏁 Script executed: Length of output: 2800 🏁 Script executed: Length of output: 246 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 92 🧠 Learnings used |
|
/verified all impacted tests: test_clone_from_block_to_fs_using_dv_template psi cluster 4.21 |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
Test Execution Plan
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 40 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 235 🏁 Script executed: Length of output: 224 🏁 Script executed: Length of output: 401 🏁 Script executed: Length of output: 70 🏁 Script executed: Length of output: 2098 🏁 Script executed: Length of output: 92 🧠 Learnings used |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/storage/utils.py`:
- Around line 513-530: The function
get_storage_profile_minimum_supported_pvc_size is duplicated; keep the single
canonical implementation in tests/storage/utils.py (the
get_storage_profile_minimum_supported_pvc_size function that uses StorageProfile
and Resource.ApiGroup.CDI_KUBEVIRT_IO), remove the duplicate from
tests/storage/cdi_upload/utils.py, and update tests/storage/cdi_upload/utils.py
to import get_storage_profile_minimum_supported_pvc_size from
tests.storage.utils so both modules reuse the same function; ensure imports
(StorageProfile/Resource usage) remain correct where the function is defined and
any now-unused local imports are removed from the cdi_upload file.
| namespace=namespace, | ||
| url=get_http_image_url(image_directory=Images.Cirros.DIR, image_name=Images.Cirros.QCOW2_IMG), | ||
| size=dv_size, | ||
| size=storage_profile_minimum_supported_pvc_size or dv_size, |
There was a problem hiding this comment.
If we explicitly use storage_profile_minimum_supported_pvc_size for all DVs, we may miss the bugs related to the min PVC size.
Please find out what is the expected behavior for cloning with the same size for provisioners with the required min pvc size. It could be a bug if there's no simple flow for this test.
There was a problem hiding this comment.
When a user requests a 1Gi DataVolume on a provider like GCP, CDI's 'smart-sizing' logic automatically provisions a 4Gi PVC to meet the infrastructure floor. Requesting 1Gi while expecting 1Gi is technically an unsupported configuration on these providers.
By using min_size if min_size > requested_size else requested_size, the utility now mirrors this expected behavior:
It respects the StorageProfile floor to prevent the environment-specific 'Pending' hangs that occur when a request is too small.
It strictly preserves the test’s original dv_size whenever it exceeds the minimum.
This approach ensures we are testing the supported and expected flow for the provisioner. We aren't masking bugs; we are ensuring the test validates a provisionable configuration rather than failing on an infrastructure limitation that CDI is already designed to handle via the StorageProfile
pelase notice that not all sc do have the storage_profile_minimum_supported_pvc_size (minimumSupportedPvcSize)
which will return empty and because of this the code is forced to use the "or" dv_size (requested)
GCP
oc get storageprofile sp-balanced-storage -o yaml
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
annotations:
cdi.kubevirt.io/minimumSupportedPvcSize: 4Gi
creationTimestamp: "2026-01-12T13:19:15Z"
generation: 5
non GCP
oc get storageprofile ocs-storagecluster-ceph-rbd-virtualization -o yaml;
apiVersion: cdi.kubevirt.io/v1beta1
kind: StorageProfile
metadata:
creationTimestamp: "2026-01-12T14:11:51Z"
generation: 1
labels:
app: containerized-data-importer
app.kubernetes.io/component: storage
app.kubernetes.io/managed-by: cdi-controller
app.kubernetes.io/part-of: hyperconverged-cluster
app.kubernetes.io/version: 4.21.0
cdi.kubevirt.io: ""
name: ocs-storagecluster-ceph-rbd-virtualization
ownerReferences:
- apiVersion: cdi.kubevirt.io/v1beta1
blockOwnerDeletion: true
controller: true
kind: CDI
name: cdi-kubevirt-hyperconverged
uid: 61696aab-b68a-47b2-a206-dec61af9776c
resourceVersion: "170590"
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/storage/utils.py`:
- Around line 516-532: The logging call in
get_storage_profile_minimum_supported_pvc_size uses an f-string which triggers
G004; change the LOGGER.info invocation to use lazy logging instead (e.g.,
LOGGER.info("Minimum supported PVC size from the StorageProfile: %s",
min_pvc_size)) so the message uses %s parameter substitution rather than an
f-string; update the call referencing LOGGER and min_pvc_size accordingly.
|
/verified all impacted tests: test_clone_from_block_to_fs_using_dv_template psi cluster 4.21 |
Test execution plan request detailsCRITICAL: You MUST post an inline review comment on the first changed line of the first file. As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. Analysis Requirements:
Your deliverable: Test Execution Plan
Guidelines:
CRITICAL WORKFLOW COMPLETION RULES: When responding to this test execution plan request, you MUST follow these rules EXACTLY:
ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):
Remember: The pull request review is visible to users. Additional comments are redundant noise. CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to: |
|
/wip |
|
/cherry-pick cnv-4.21 |
|
Cherry-pick requested for PR: |
|
related to CNV-79503 (jira) |
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has not been updated in past 30 days. |
Short description:
fix test_clone_from_block_to_fs_using_dv_template fails because of sizing issue in the dv creation
the proposed change Update create_cirros_dv utility to respect the minimumSupportedPVCSize from StorageProfile.
More details:
GCP storage class (balanced-storage) does not support PVC who is smaller than 4Gi
the test test_clone_from_block_to_fs_using_dv_template creates Two PVCs — source (block) and
target (filesystem) and set size of create_vm_from_clone_dv_template to 1Gi instead of 4Gi
the triggered DV that is being created by create_vm_from_clone_dv_template is in pending forever
because of the size that he recieve does not match the minimum
the fix Update create_cirros_dv utility to respect the minimumSupportedPVCSize from StorageProfile
What this PR does / why we need it:
This ensures infrastructure compatibility across different cloud providers. By fixing this at the utility level, we maintain the integrity of functional tests (like test_clone_from_block_to_fs_using_dv_template) without needing to change their specific logic or add manual PVC size lookups inside the test files.
Which issue(s) this PR fixes:
Fixes test_clone_from_block_to_fs_using_dv_template and other Cirros-based tests failing on GCP due to disk size constraints.
Special notes for reviewer:
jira-ticket:
https://issues.redhat.com/browse/CNV-76200
Summary by CodeRabbit
Tests
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.