-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Compute] az vm disk attach: Add new parameters --source-snapshots-or-disks --source-disk-restore-point to support implicit disk creation from snapshot and disk restore points
#31830
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2092,7 +2092,8 @@ def show_default_diagnostics_configuration(is_windows_os=False): | |||||
|
|
||||||
| # region VirtualMachines Disks (Managed) | ||||||
| def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=None, disks=None, new=False, sku=None, | ||||||
| size_gb=None, lun=None, caching=None, enable_write_accelerator=False, disk_ids=None): | ||||||
| size_gb=None, lun=None, caching=None, enable_write_accelerator=False, disk_ids=None, | ||||||
| source_snapshots_or_disks=None, source_disk_restore_point=None): | ||||||
| # attach multiple managed disks using disk attach API | ||||||
| vm = get_vm_to_update(cmd, resource_group_name, vm_name) | ||||||
| if not new and not sku and not size_gb and disk_ids is not None: | ||||||
|
|
@@ -2148,6 +2149,33 @@ def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=N | |||||
| data_disk.write_accelerator_enabled = enable_write_accelerator | ||||||
|
|
||||||
| vm.storage_profile.data_disks.append(data_disk) | ||||||
| disk_lun = _get_disk_lun(vm.storage_profile.data_disks) | ||||||
| if source_snapshots_or_disks is not None: | ||||||
| for disk_item in source_snapshots_or_disks: | ||||||
| disk = { | ||||||
|
||||||
| 'create_option': 'Copy', | ||||||
| 'caching': caching, | ||||||
|
||||||
| 'caching': caching, | |
| **({'caching': caching} if caching is not None else {}), |
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.
Use parentheses to wrap this multi-line if condition instead of a backslash continuation for better readability and to comply with the guideline on breaking long expressions.