[Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points#31862
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @Jing-song, |
️✔️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.
Pull Request Overview
This PR enhances the az vm disk attach command to support setting disk size and SKU parameters when implicitly creating disks from snapshots and disk restore points. Previously, these parameters were only supported for creating new empty disks, but this change extends the functionality to handle copy and restore operations.
- Adds
size_gbandskuparameter support for disk creation from snapshots and restore points - Updates test cases to validate the new functionality with size and SKU verification
- Modifies the disk attachment logic to handle size and SKU specification for copy and restore operations
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Enhanced attach_managed_data_disk function to support size and SKU parameters for copy and restore operations |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Updated test case to verify size and SKU functionality for disk attachment from snapshots and restore points |
| "managedDisk": { | ||
| "storageAccountType": sku, | ||
| } | ||
| }) |
There was a problem hiding this comment.
Inconsistent indentation detected. This line uses 9 spaces for indentation instead of multiples of 4 spaces.
| disk.update({ | ||
| 'sizeGb': size_gb | ||
| }) | ||
| if sku is not None: |
There was a problem hiding this comment.
Inconsistent indentation detected. This line uses 5 spaces for indentation instead of the required 4 spaces.
| 'sizeGb': size_gb | ||
| }) | ||
| if sku is not None: | ||
| disk.update({ |
There was a problem hiding this comment.
Inconsistent indentation detected. This line uses 9 spaces for indentation instead of multiples of 4 spaces.
| if sku is not None: | ||
| disk.update({ | ||
| "managedDisk": { | ||
| "storageAccountType": sku, |
There was a problem hiding this comment.
Inconsistent indentation detected. This line uses 17 spaces for indentation instead of multiples of 4 spaces.
az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points
az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore pointsaz vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points
Related command
az vm disk attachDescription
Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis 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.