-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute] migrate vm disk attach/detach to aaz #32583
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
|
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the az vm disk attach and az vm disk detach commands from hand-written SDK code to the AAZ (Azure CLI Auto-generated) framework. The migration introduces the use of AAZ operations (AttachDetachDataDisk, VMShow, VMUpdate) while maintaining backward compatibility for different disk attachment scenarios.
Key changes include:
- Refactored
attach_managed_data_diskto use AAZ operations for existing disk attachments and VMUpdate for new/copy/restore operations - Refactored
detach_managed_data_diskto use AAZ operations with improved error handling - Added a new
safe_getutility function for safely accessing nested dictionary keys
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Refactored disk attach/detach functions to use AAZ operations; added no_wait parameter support; reorganized logic into separate code paths for different attachment types |
| src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py | Added new safe_get utility function for safe nested dictionary access with fallback defaults |
💡 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.