Skip to content

Commit 39d51fa

Browse files
adewaleoyugangw-msft
authored andcommitted
[image] create. Add --os-disk-caching parameter. (#7919)
1 parent d519d2d commit 39d51fa

File tree

5 files changed

+341
-263
lines changed

5 files changed

+341
-263
lines changed

src/command_modules/azure-cli-vm/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Release History
88
* `vm extension show / wait`: deprecated --expand parameter.
99
* `vm restart`: Added `--force` which redeploys unresponsive VMs.
1010
* `vm/vmss create`: `--authentication-type` now accepts/infers "all" to create a VM with both password and ssh authentication.
11+
* `image create`: Added `--os-disk-caching` parameter to set os disk caching for an image.
1112

1213
2.2.8
1314
++++++

src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def load_arguments(self, _):
114114
c.argument('zone_resilient', min_api='2017-12-01', arg_type=get_three_state_flag(), help='Specifies whether an image is zone resilient or not. '
115115
'Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage')
116116
c.argument('storage_sku', arg_type=disk_sku, help='The SKU of the storage account with which to create the VM image. Unused if source VM is specified.')
117+
c.argument('os_disk_caching', arg_type=get_enum_type(CachingTypes), help="Storage caching type for the image's OS disk.")
117118
c.ignore('source_virtual_machine', 'os_blob_uri', 'os_disk', 'os_snapshot', 'data_blob_uris', 'data_disks', 'data_snapshots')
118119
# endregion
119120

src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def create_image(cmd, resource_group_name, name, source, os_type=None, data_disk
316316
source_virtual_machine=None, storage_sku=None,
317317
os_blob_uri=None, data_blob_uris=None,
318318
os_snapshot=None, data_snapshots=None,
319-
os_disk=None, data_disks=None, tags=None, zone_resilient=None):
319+
os_disk=None, os_disk_caching=None, data_disks=None, tags=None, zone_resilient=None):
320320
ImageOSDisk, ImageDataDisk, ImageStorageProfile, Image, SubResource, OperatingSystemStateTypes = cmd.get_models(
321321
'ImageOSDisk', 'ImageDataDisk', 'ImageStorageProfile', 'Image', 'SubResource', 'OperatingSystemStateTypes')
322322

@@ -328,6 +328,7 @@ def create_image(cmd, resource_group_name, name, source, os_type=None, data_disk
328328
else:
329329
os_disk = ImageOSDisk(os_type=os_type,
330330
os_state=OperatingSystemStateTypes.generalized,
331+
caching=os_disk_caching,
331332
snapshot=SubResource(id=os_snapshot) if os_snapshot else None,
332333
managed_disk=SubResource(id=os_disk) if os_disk else None,
333334
blob_uri=os_blob_uri,

0 commit comments

Comments
 (0)