{Compute} az vm/vmss create: Add SpotPlus option in --priority - #34030
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The change is localized (enum/help + scenario test + recording) and the end-to-end test verifies SpotPlus is sent through correctly.
Pull request overview
Adds CLI support and scenario coverage for the new SpotPlus value on --priority for az vm create and az vmss create, aligning with the Compute RP’s new priority option and validating it end-to-end via recorded live tests.
Changes:
- Extend
--priorityenum to includeSpotPlusand update command help text. - Add a new scenario test covering VM create + Uniform/Flexible VMSS create using
--priority SpotPluswith eviction policy and max price. - Add the corresponding test recording for playback.
File summaries
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/_params.py |
Adds SpotPlus to the Priority enum and updates help text for vm/vmss create. |
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py |
Introduces a new scenario test validating SpotPlus behavior for VM + VMSS create flows. |
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_vmss_create_with_spot_plus_priority.yaml |
Recorded HTTP interactions for the new SpotPlus scenario test. |
Review details
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/vm/_params.py:1441
- Same grammar issue in the vmss create-specific help text: "Default to Regular." should be "Defaults to Regular."
c.argument('priority', arg_type=get_enum_type(Priority, default=None),
help="Priority. Use 'Spot' or 'SpotPlus' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' or 'SpotPlus' to deploy Azure spot VM and/or VMSS. Default to Regular.")
- Files reviewed: 2/3 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.
| c.argument('priority', | ||
| arg_type=get_enum_type(Priority, default=None), | ||
| help="Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.") | ||
| help="Priority. Use 'Spot' or 'SpotPlus' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' or 'SpotPlus' to deploy Azure spot VM and/or VMSS. Default to Regular.") |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
Live test results —
|
|
Compute |
There was a problem hiding this comment.
Upstream CI
Azure.azure-cli Full Test
- Result: failure
- Included checks:
Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance2),Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance2) - Failure details:
- Automation Full Test Python312 Profile Latest instance2 / azdev test
- Evidence:
Matchers failed: host - assertion failure: azcliprod.blob.core.windows.net != raw.githubusercontent.com; path - assertion failure: /cli/vm/aliases.json != /Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json. Can't overwrite existing cassette ('.../recordings/test_vm_vmss_create_with_spot_plus_priority.yaml') in record mode 'once'. No match for the request (GET https://azcliprod.blob.core.windows.net/cli/vm/aliases.json) was found. - Next action: Re-record
test_vm_vmss_create_with_spot_plus_priority.yamlagainst the currentaliases.jsonsource so the recorded request host/path match what the test actually issues. - Verify: Re-run
Automation Full Test Python312 Profile Latest instance2 / azdev testand confirm the cassette match succeeds.
- Evidence:
- Automation Full Test Python314 Profile Latest instance2 / azdev test
- Evidence: Same cassette mismatch as above, reproduced on the Python 3.14 profile job.
- Next action: Same fix as above; a single recording re-capture resolves both jobs.
- Verify: Re-run
Automation Full Test Python314 Profile Latest instance2 / azdev testand confirm the cassette match succeeds.
- Automation Full Test Python312 Profile Latest instance2 / azdev test
Test validation
- Live test: Failed with conclusion
failure(same cassette mismatch as the Azure DevOps CI failure below — the newtest_vm_vmss_create_with_spot_plus_priorityrecording doesn't match the livealiases.jsonrequest the test now issues). - Regression coverage: Present for
vm: 1 focused test file and 1 recording file changed alongside the production_params.pychange — no coverage gap.
Classification
Both failing jobs point to the same root cause and are PR-related: the recording this PR adds (test_vm_vmss_create_with_spot_plus_priority.yaml) was captured against an aliases.json host/path (raw.githubusercontent.com/.../quickstart-templates/aliases.json) that no longer matches what the code under test requests at runtime (azcliprod.blob.core.windows.net/cli/vm/aliases.json). This is not an unrelated/infra flake — it is the PR's own new test failing to replay because its cassette is stale relative to the current request path.
Next action: Re-record test_vm_vmss_create_with_spot_plus_priority.yaml (or otherwise update the mocked aliases.json request in the test) so the recorded host/path matches the live request, then rerun azdev test vm locally and re-trigger the two failing Azure DevOps jobs to confirm.
Risk assessment
25/100 · Medium · High confidence
The Medium rating is driven by public CLI behavior.
- Change scope: 3 changed files, 2361 changed lines (
+2358/-3), including 1 production file. - Affected components:
vm - Risk drivers: public CLI behavior (+18)
- Regression evidence: Changed regression tests are included, reducing risk.
- Confidence: High because changed-line patches were available for every production file.
- Required review: Owning-squad review is recommended for
vmbefore merge.
|
🔔 Routing this PR to @Azure/act-observability-squad. |
🤖 PR Validation —⚠️ Review suggested
Related command
az vm createaz vmss createDescription
Resolve #33881
Testing Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:test_vm_vmss_create_with_spot_plus_priorityHistory Notes
[Compute]
az vm/vmss create: AddSpotPlusoption in--priorityparameterThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.