Support: change independent_nonpersistent disk mode after cloud-init#369
Conversation
independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor
Review Summary by QodoFix independent_nonpersistent disk mode after cloud-init completion
WalkthroughsDescription• Add change_disk_mode() method to VMWareProvider for disk reconfiguration • Create nonpersistent_disk_ready fixture to change disk mode after cloud-init • Remove disk_mode from config to create disks as persistent during clone • Add test_check_xcopy_used test to verify XCOPY acceleration usage Diagramflowchart LR
A["VM Clone<br/>Persistent Disk"] -->|"Cloud-init<br/>completes"| B["VM Powered Off"]
B -->|"change_disk_mode<br/>called"| C["Disk Mode Changed<br/>to independent_nonpersistent"]
C -->|"Migration<br/>with XCOPY"| D["Verify XCOPY<br/>Acceleration"]
File Changes1. libs/providers/vmware.py
|
Code Review by Qodo
1. multus_network_name requested twice
|
|
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds VMWareProvider.change_disk_mode(...) to reconfigure VM disk modes; a class-scoped pytest fixture applies it during test setup; tests updated to use the fixture and include an XCOPY verification; test config no longer specifies disk_mode. Changes
Sequence Diagram(s)sequenceDiagram
participant Pytest as Pytest Framework
participant Fixture as nonpersistent_disk_ready
participant Provider as VMWareProvider
participant VMware as vSphere API
participant VM as VirtualMachine
Pytest->>Fixture: run class fixture
Fixture->>Fixture: iterate prepared_plan virtual_machines
Fixture->>Provider: resolve provider_vm_api for VM
Fixture->>Provider: change_disk_mode(vm, "independent_nonpersistent")
Provider->>VMware: build ConfigSpec with deviceChange edits
Provider->>VMware: vm.ReconfigVM_Task(ConfigSpec)
VMware->>VM: apply disk backing changes
VMware-->>Provider: task completion
Provider->>Fixture: log per-disk changes and success
Fixture->>Pytest: fixture completes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
/verified |
Made-with: Cursor
|
Persistent review updated to latest commit 8c2c2c1 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@libs/providers/vmware.py`:
- Around line 813-859: Validate the disk_mode string before calling
vm.ReconfigVM_Task in the change-disk-mode method (the method that checks
vm.runtime.powerState, builds device_changes and calls self.wait_task),
restricting it to the supported values ("independent_nonpersistent",
"independent_persistent", "persistent"); if disk_mode is not one of these, raise
a domain-specific exception (add or reuse an exception in
exceptions/exceptions.py such as InvalidDiskModeError) instead of letting the
ReconfigVM_Task fail, and adjust any callers/tests if needed to expect the new
exception.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 23f944cc-15ba-4401-a5d8-e53e96aacacb
📒 Files selected for processing (1)
libs/providers/vmware.py
|
/verified |
|
/lgtm |
|
New container for ghcr.io/redhatqe/mtv-api-tests:latest published |
|
Persistent review updated to latest commit c73e7b6 |
|
/cherry-pick v2.11 v2.10 |
…369) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor
|
Cherry-picked PR Support: change independent_nonpersistent disk mode after cloud-init into v2.11: #382 |
…369) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor
|
Cherry-picked PR Support: change independent_nonpersistent disk mode after cloud-init into v2.10: #383 |
|
/cherry-pick v2.11 v2.10 |
…369) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor
|
Cherry-picked PR Support: change independent_nonpersistent disk mode after cloud-init into v2.11: #385 |
…369) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor
|
Cherry-picked PR Support: change independent_nonpersistent disk mode after cloud-init into v2.10: #386 |
…369) (#386) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor Co-authored-by: Polina Rabinovich <58551443+prabinovRedhat@users.noreply.github.com>
…369) (#385) * fix: change disk mode to independent_nonpersistent after cloud-init independent_nonpersistent disks lose data on power-off, so the disk must be created as regular persistent during clone, then changed after cloud-init completes and the VM is powered off. - Remove disk_mode from config (defaults to persistent during clone) - Add VMWareProvider.change_disk_mode() for ReconfigVM_Task - Add nonpersistent_disk_ready fixture that chains after cloud-init Made-with: Cursor * feat: add test_check_xcopy_used to independent nonpersistent test class Made-with: Cursor * fix: add power state validation in change_disk_mode() Made-with: Cursor * docs: document 6-step copy-offload test pattern in CLAUDE.md Made-with: Cursor * docs: reference verify_xcopy_used utility instead of implementation detail Made-with: Cursor Co-authored-by: Polina Rabinovich <58551443+prabinovRedhat@users.noreply.github.com>
## Summary
- Check if cherry-pick label already exists on the PR before processing
- Skip branches whose `cherry-pick-{branch}` label is already present
- Post comment telling user to remove the label to re-trigger
- Works for both merged and unmerged PRs
- Early return when no valid target branches (avoids unnecessary API
calls)
Triggered by duplicate cherry-pick PRs on
RedHatQE/mtv-api-tests#369
Closes #1054
## Test plan
- [x] `test_process_cherry_pick_command_skips_already_cherry_picked` -
partial skip (merged PR)
- [x] `test_process_cherry_pick_command_all_already_cherry_picked` -
full skip (merged PR)
- [x]
`test_process_cherry_pick_command_skips_already_cherry_picked_unmerged`
- partial skip (unmerged PR)
- [x] All existing cherry-pick tests pass (9 total)
- [x] All 200 tests pass
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Cherry-pick operations now skip branches that are already labeled,
post a comment listing skipped branches with re-trigger instructions,
and return early if no valid targets remain.
* Label naming/formatting standardized for consistency.
* Per-branch handling ensures failed label additions skip that branch
without affecting others.
* **Tests**
* Added idempotency and skip-case tests covering merged/unmerged PRs and
label-add failures.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
independent_nonpersistentdisks lose data on power-off, so cloud-init data was lost when the VM was powered off after setupdisk_mode: independent_nonpersistentfrom config so the disk is created as regular persistent during cloneVMWareProvider.change_disk_mode()method to change disk backing mode viaReconfigVM_Tasknonpersistent_disk_readyfixture that chains aftervmware_cloud_init_readyand changes the added disk mode toindependent_nonpersistentafter the VM is powered offtest_check_xcopy_usedtoTestCopyoffloadIndependentNonpersistentDiskMigrationTest plan
TestCopyoffloadIndependentNonpersistentDiskMigration- all tests passedSummary by CodeRabbit
New Features
Tests
Chores
Documentation