-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute] az vm disk attach: Add new parameter --new-names-of-source-snapshots-or-disks to support setting the name of create new disk from a snapshot or another disk
#32172
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
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @Jing-song, |
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vm disk attach | cmd vm disk attach added parameter new_names_of_source_disk_restore_point |
||
| vm disk attach | cmd vm disk attach added parameter new_names_of_source_snapshots_or_disks |
|
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
This PR adds support for naming new disks when creating them from snapshots, existing disks, or disk restore points in the az vm disk attach command.
- Add two new optional parameters to specify custom names for newly created disks
- Implement validation logic to ensure proper parameter usage and count matching
- Update test coverage to verify the new functionality and error handling
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| _params.py | Adds the two new command-line parameters with help text |
| _validators.py | Implements validation logic for the new parameters |
| custom.py | Updates disk attachment logic to use custom names when provided |
| test_vm_commands.py | Adds test cases for the new parameters and error scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| c.argument('new_names_of_source_snapshots_or_disks', options_list=['--new-names-of-source-snapshots-or-disks', '--new-names-of-sr'], nargs='+', min_api='2024-11-01', help='The name of create new data disk from a snapshot or another disk.') | ||
| c.argument('new_names_of_source_disk_restore_point', options_list=['--new-names-of-source-disk-restore-point', '--new-names-of-rp'], nargs='+', min_api='2024-11-01', help='The name of create new data disk from a disk restore point.') |
Copilot
AI
Sep 25, 2025
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.
The help messages should start with verbs in active voice. Change 'The name of create new data disk' to 'Name the new data disk' for both parameters.
| raise RequiredArgumentMissingError("Please use --source-snapshots-or-disks when using" | ||
| " --new-names-of-source-snapshots-or-disks") | ||
| if namespace.new_names_of_source_disk_restore_point and not namespace.source_disk_restore_point: | ||
| raise RequiredArgumentMissingError("Please use --source-disk-restore-point when using" |
Copilot
AI
Sep 25, 2025
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.
The error messages reference incorrect parameter names. Line 1896 should reference --source-resource (the shorter alias), and line 1899 should reference --source-disk-rp to match the test expectations and actual parameter aliases.
| raise RequiredArgumentMissingError("Please use --source-snapshots-or-disks when using" | |
| " --new-names-of-source-snapshots-or-disks") | |
| if namespace.new_names_of_source_disk_restore_point and not namespace.source_disk_restore_point: | |
| raise RequiredArgumentMissingError("Please use --source-disk-restore-point when using" | |
| raise RequiredArgumentMissingError("Please use --source-resource when using" | |
| " --new-names-of-source-snapshots-or-disks") | |
| if namespace.new_names_of_source_disk_restore_point and not namespace.source_disk_restore_point: | |
| raise RequiredArgumentMissingError("Please use --source-disk-rp when using" |
Related command
az vm disk attachDescription
Support setting the name of create new disk from a snapshot or another disk or disk restore point.
Testing Guide
History Notes
[Compute]
az vm disk attach: Add new parameter--new-names-of-source-snapshots-or-disksto support setting the name of create new disk from a snapshot or another disk[Compute]
az vm disk attach: Add new parameter--new-names-of-source-disk-restore-pointto support setting the name of create new disk from a disk restore pointThis 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.