-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Compute} migrate vm disk attach/detach to aaz #32675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @huiii99, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Migrates az vm disk attach / az vm disk detach from handwritten SDK logic to AAZ-based implementations, with corresponding test and recording updates.
Changes:
- Reworked managed disk attach/detach logic in
vm/custom.pyto use AAZ commands. - Updated scenario tests and re-recorded HTTP interactions for the new behavior / API versions.
- Added a small
safe_gethelper for nested dict access used by the new detach flow.
Reviewed changes
Copilot reviewed 7 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Migrates VM disk attach/detach implementation to AAZ (core behavior change). |
| src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py | Adds safe_get helper for nested dict access used by new logic. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Updates VM scenario tests to reflect new behavior and VM create parameters. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_ultra_ssd_storage_sku.yaml | Updates recordings for new compute API version. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_disk_storage_sku.yaml | Updates recordings for new compute API version. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_disk_attach_from_copy_and_restore.yaml | Updates recordings for new compute API version. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_disk_attach_detach_api.yaml | Updates recordings for new compute API version. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/vm/custom.py:2468
AttachDetachDataDiskexpects snake_case element fields (disk_id,detach_option) but this list usesdiskId/detachOption, which will likely be ignored and violate the requireddisk_idfield. Also, this branch doesn't forward theno_waitparameter to the AAZ command. Use the AAZ arg names and includeno_waitincommand_args.
for disk_item in disk_ids:
disk = {'diskId': disk_item, 'detachOption': 'ForceDetach' if force_detach else None}
data_disks.append(disk)
result = AttachDetachDataDisk(cli_ctx=cmd.cli_ctx)(command_args={
'vm_name': vm_name,
'resource_group': resource_group_name,
'data_disks_to_detach': data_disks
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
az vm disk attachaz vm disk detachDescription
Migrate
az vm disk attachandaz vm disk detachcommands from hand written sdk to aaz.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.