vm-repair: select a compatible repair VM disk controller - #10305
Conversation
Detect the source VM and selected SKU disk controller capabilities, prefer SCSI when supported, and allow an explicit controller override. Add focused tests, help text, release history, and version metadata.
|
Hi Edwin Bernal Microsoft (@EdwinBernal1), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The override path currently still performs additional CLI/ARM fetches that can fail or slow execution even when --disk-controller-type is provided, weakening the “override always wins” behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the vm-repair extension to more reliably create repair VMs with a disk controller compatible with existing offline repair scripts (especially when the source VM uses NVMe), and introduces an explicit CLI override for controller selection.
Changes:
- Adds disk-controller detection (SDK with CLI fallback), VM SKU capability lookup, and controller-selection logic to prefer SCSI where supported for NVMe-source scenarios.
- Introduces
--disk-controller-type {SCSI,NVMe}with case-insensitive normalization and early validation. - Adds focused unit tests for controller selection, parsing, and validation; bumps extension version and updates release history.
File summaries
| File | Description |
|---|---|
| src/vm-repair/setup.py | Bumps extension version to 2.3.0. |
| src/vm-repair/HISTORY.rst | Adds 2.3.0 release notes describing the controller-selection behavior and new parameter. |
| src/vm-repair/azext_vm_repair/tests/latest/test_disk_controller_type.py | Adds unit tests covering selection behavior, SKU parsing, and validator normalization/rejection. |
| src/vm-repair/azext_vm_repair/repair_utils.py | Adds helpers to fetch source controller type, fetch SKU controller capabilities, and select the repair controller with messaging. |
| src/vm-repair/azext_vm_repair/custom.py | Integrates controller selection into the nested az vm create invocation. |
| src/vm-repair/azext_vm_repair/_validators.py | Validates/normalizes --disk-controller-type before other network/version checks. |
| src/vm-repair/azext_vm_repair/_params.py | Adds the disk_controller_type argument to vm repair create. |
| src/vm-repair/azext_vm_repair/_help.py | Documents an example using --disk-controller-type NVMe. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Skip source and SKU controller discovery when an explicit override is provided, and query SKU capabilities only for NVMe source VMs.
|
vm-repair |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
🟡 Changes recommended
The source disk controller detection currently mishandles SDK Enum values (breaking NVMe detection and the SCSI-pinning path), and the version bump is inconsistent with the PR description.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
Handle enum-backed disk controller values and incomplete source VM models safely. Add regression coverage for enum values, missing storage profiles, and missing VM IDs.
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ vm-repair-2.3.1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=179960572&view=results |
🤖 PR Validation —⚠️ Review suggested
Summary
Select a compatible disk controller for VM Repair creation so repair scripts that expect SCSI-attached disks can reliably locate and repair the copied OS disk.
Related command
az vm repair createDescription
Problem
When the source VM uses NVMe, a repair VM size that supports both SCSI and NVMe can inherit an NVMe controller. Several repair scripts locate the attached OS disk by its SCSI model name; on an NVMe repair VM they can complete without repairing the intended disk.
Changes
DiskControllerTypescapability.SCSIwhen an NVMe source uses a size supporting both SCSI and NVMe.--disk-controller-type {SCSI,NVMe}as an explicit override.Design rationale
The automatic behavior changes only the problematic NVMe-source path. Existing SCSI-source behavior remains unchanged. An explicit override always wins, while unavailable SKU capability data falls back to the platform default rather than blocking repair creation.
Testing details
python scripts/ci/test_index.py -q: 9 run, 7 passed, 2 skipped, exit code 0.azdev style vm-repairwas attempted in isolation. Flake8 passed, but Pylint could not resolve standard-library modules such asos,json, anddatetime, indicating an isolated-environment configuration failure.Risk assessment
Additional information
The branch contains one focused commit based on current
main; unrelated--no-cleanupchanges were removed.General Guidelines
azdev style <YOUR_EXT>locally?python scripts/ci/test_index.py -qlocally?src/index.jsonis intentionally unchanged; publication automation updates it after merge.'@; gh pr create -R Azure/azure-cli-extensions --base main --head 'EdwinBernal1:edwin/vmrepair-disk-controller-type' --title 'vm-repair: select a compatible repair VM disk controller' --body $body