{Compute} az vm host: Migrate command group to aaz-based implementation#32908
{Compute} az vm host: Migrate command group to aaz-based implementation#32908william051200 wants to merge 7 commits intoAzure:devfrom
az vm host: Migrate command group to aaz-based implementation#32908Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vm host show | cmd vm host show update parameter expand: updated property choices from ['instanceView', 'userData'] to ['instanceView', 'resiliencyView', 'userData'] |
||
| vm host update | cmd vm host update added parameter no_wait |
||
| vm host update | cmd vm host update update parameter host_group_name: added property aaz_type=string |
||
| vm host update | cmd vm host update update parameter host_group_name: added property type=string |
||
| vm host update | cmd vm host update update parameter host_name: added property aaz_type=string |
||
| vm host update | cmd vm host update update parameter host_name: added property type=string |
||
| vm host update | cmd vm host update update parameter properties_to_add: added property aaz_type=AAZGenericUpdateAddArg |
||
| vm host update | cmd vm host update update parameter properties_to_remove: added property aaz_type=AAZGenericUpdateRemoveArg |
||
| vm host update | cmd vm host update update parameter properties_to_set: added property aaz_type=AAZGenericUpdateSetArg |
||
| vm host update | cmd vm host update update parameter resource_group_name: added property aaz_type=string |
||
| vm host update | cmd vm host update update parameter resource_group_name: added property type=string |
||
| vm host update | cmd vm host update update parameter resource_group_name: updated property name from resource_group_name to resource_group |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
Migrates the az vm host command group away from the azure.mgmt.compute SDK to an AAZ-based implementation, aligning dedicated host operations with the newer generated command surface.
Changes:
- Replaces
vm host createandvm host get-instance-viewcustom implementations to invoke AAZ commands. - Replaces
vm host update(generic update via SDK) with an AAZUpdatecommand wrapped by a small schema customizer. - Removes the dedicated-host SDK client factory wiring from
vm/commands.pyand_client_factory.py.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/operations/vm_host.py |
Adds a wrapper command class to customize AAZ vm host update argument schema/options. |
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Re-implements vm host create and vm host get-instance-view by calling AAZ Create/Show. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Removes SDK-based vm host command group wiring and registers AAZ-based update. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/host/_update.py |
Introduces generated AAZ implementation for vm host update. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/host/_show.py |
Updates generated Show to newer API version and expands enum/output schema. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/host/_create.py |
Introduces generated AAZ implementation used by the custom create_dedicated_host wrapper. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/host/__init__.py |
Exports new generated Create and Update classes. |
src/azure-cli/azure/cli/command_modules/vm/_client_factory.py |
Removes unused dedicated host client factory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if license_type: | ||
| command_args['license_type'] = license_type | ||
|
|
||
| if platform_fault_domain: |
There was a problem hiding this comment.
platform_fault_domain can legitimately be 0 (see _params.py allows 0,1,2), but this truthy check will skip adding it to command_args, changing behavior for az vm host create -d 0 and breaking existing tests/recordings. Use an explicit is not None check (and similarly avoid truthy checks for other numeric args).
| if platform_fault_domain: | |
| if platform_fault_domain is not None: |
| "version": "2022-11-01", | ||
| "resources": [ | ||
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2022-11-01"], |
There was a problem hiding this comment.
This generated Update command uses API version 2022-11-01, but other vm host operations (e.g. vm/host/_show.py and the existing vm host update test recordings) use 2024-11-01. This will change request URIs and may break playback tests and/or behavior. Align the _aaz_info resources and api-version query parameter to the same version used by the other dedicated host commands.
| "version": "2022-11-01", | |
| "resources": [ | |
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2022-11-01"], | |
| "version": "2024-11-01", | |
| "resources": [ | |
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2024-11-01"], |
| ) | ||
| _args_schema.expand = AAZStrArg( | ||
| options=["--expand"], | ||
| help="The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host.", |
There was a problem hiding this comment.
The --expand help text still says only instanceView is supported and userData is not, but the enum now includes resiliencyView. Update the help text so it documents the newly supported value (and clarify any dedicated-host limitations).
| help="The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host.", | |
| help="The expand expression to apply on the operation. 'instanceView' will retrieve the list of instance views of the dedicated host. 'resiliencyView' will retrieve the resiliency status of the dedicated host. For dedicated hosts, 'userData' is not supported.", |
| ) | ||
| _args_schema.host_name = AAZStrArg( | ||
| options=["-n", "--name", "--host-name"], | ||
| help="The name of the dedicated host .", |
There was a problem hiding this comment.
Help string has an extra space before the period ("dedicated host ."), which shows up in -h output. Please fix the punctuation/spacing.
| help="The name of the dedicated host .", | |
| help="The name of the dedicated host.", |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az vm host createaz vm host showaz vm host get-instance-viewaz vm host updateDescription
Migration from mgmt.compute to aaz-based
aaz Azure/aaz#953
Testing Guide
History Notes
This 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.