Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-vm/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Release History
* `vm extension show / wait`: deprecated --expand parameter.
* `vm restart`: Added `--force` which redeploys unresponsive VMs.
* `vm/vmss create`: `--authentication-type` now accepts/infers "all" to create a VM with both password and ssh authentication.
* `image create`: Added `--os-disk-caching` parameter to set os disk caching for an image.

2.2.8
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def load_arguments(self, _):
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. '
'Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage')
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.')
c.argument('os_disk_caching', arg_type=get_enum_type(CachingTypes), help="Storage caching type for the image's OS disk. Default: None")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You likely don't need the Default: None in the help. Most optional parameters will default to a null value.

Copy link
Contributor Author

@adewaleo adewaleo Nov 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@williexu, I mentioned the default value used, to keep in line with the os-disk-caching parameter's help text and behavior in VM create. The help text specifies that the default os disk caching is "ReadWrite".

One of the os caching enum's values is the string "None" (not null). I think it would be good to let users know what default os_disk_caching is used to create an image if the option is not used, even if in this case it is "None". I will update the code to explicitly use the enum's "None" value, if os caching is unspecified.

c.ignore('source_virtual_machine', 'os_blob_uri', 'os_disk', 'os_snapshot', 'data_blob_uris', 'data_disks', 'data_snapshots')
# endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def create_image(cmd, resource_group_name, name, source, os_type=None, data_disk
source_virtual_machine=None, storage_sku=None,
os_blob_uri=None, data_blob_uris=None,
os_snapshot=None, data_snapshots=None,
os_disk=None, data_disks=None, tags=None, zone_resilient=None):
os_disk=None, os_disk_caching=None, data_disks=None, tags=None, zone_resilient=None):
ImageOSDisk, ImageDataDisk, ImageStorageProfile, Image, SubResource, OperatingSystemStateTypes = cmd.get_models(
'ImageOSDisk', 'ImageDataDisk', 'ImageStorageProfile', 'Image', 'SubResource', 'OperatingSystemStateTypes')

Expand All @@ -328,6 +328,7 @@ def create_image(cmd, resource_group_name, name, source, os_type=None, data_disk
else:
os_disk = ImageOSDisk(os_type=os_type,
os_state=OperatingSystemStateTypes.generalized,
caching=os_disk_caching,
snapshot=SubResource(id=os_snapshot) if os_snapshot else None,
managed_disk=SubResource(id=os_disk) if os_disk else None,
blob_uri=os_blob_uri,
Expand Down
Loading