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
[VM/VMSS] Improved disk caching support #2522
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2522 +/- ##
=========================================
+ Coverage 72.1% 72.1% +<.01%
=========================================
Files 362 362
Lines 19790 19791 +1
Branches 2920 2920
=========================================
+ Hits 14269 14270 +1
Misses 4600 4600
Partials 921 921
Continue to review full report at Codecov.
|
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.
LGTM to overall. Left a few suggestions
@@ -253,7 +253,7 @@ def build_vm_resource( # pylint: disable=too-many-locals | |||
name, location, tags, size, storage_profile, nics, admin_username, | |||
availability_set_id=None, admin_password=None, ssh_key_value=None, ssh_key_path=None, | |||
image_reference=None, os_disk_name=None, custom_image_os_type=None, | |||
storage_caching=None, storage_sku=None, | |||
os_caching=None, data_caching=None, storage_sku=None, |
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.
I suggest exposing --os-disk-caching
and --data-disk-caching
. Were this PR out last month, these short names look pretty good; but now with customdata
and secret
support, it is necessary to be a bit complete to avoid potential confusions.
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.
I prefer to keep this short. It is consistent with --os-type
(which refers to a disk) and is in the storage argument group, so I think it's pretty clear.
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.
With help it will be clear, but there is also a scenario that when you read existing commands, the meaning should be clear w/o referring to help.
There are lots and lots of caching mechanisms in the whole stack from CPU cache to the web page cache at the top, so when I talk about cache, I have to be very specific on the term and context, otherwise people would not understand. This is why I am not quite into the argument naming of --os-caching
, and --data-cache
, because they could mean lots of different things.
However, I would not let my own experience/knowledge to determine the naming for wide audience. So /cc: @gbowerman @gatneil, if they are fine with this short naming, I will be fine too.
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.
Although longer, we probably need 'disk' in the names for clarity, e.g. --os-disk-caching, --data-disk-caching, or --os-disk-cache, --data-disk-cache.
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.
done
@@ -403,7 +403,7 @@ def _build_data_disks(profile, data_disk_sizes_gb, image_data_disks, | |||
'lun': lun, | |||
'createOption': "empty", | |||
'diskSizeGB': int(size), | |||
'caching': storage_caching, | |||
'caching': data_caching, |
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.
Please set the caching on data disks coming with the managed image itself. The code is about 10 lines above
@@ -542,7 +543,7 @@ def build_vmss_resource(name, naming_prefix, location, tags, overprovision, upgr | |||
elif storage_profile in [StorageProfile.ManagedPirImage, StorageProfile.ManagedPirImage]: |
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.
since we are here, please fix it to be [StorageProfile.ManagedPirImage, StorageProfile.ManagedCustomImage]
@@ -289,7 +289,7 @@ def _validate_vm_create_storage_profile(namespace, for_scale_set=False): | |||
|
|||
elif namespace.storage_profile == StorageProfile.SASpecializedOSDisk: | |||
required = ['os_type', 'attach_os_disk', 'use_unmanaged_disk'] | |||
forbidden = ['os_disk_name', 'storage_caching', 'image', 'storage_account', | |||
forbidden = ['os_disk_name', 'os_caching', 'image', 'storage_account', |
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.
i think for any unmanaged storage profiles, the data_caching
would not apply, hence we should error
@@ -222,11 +223,12 @@ def get_vm_size_completion_list(prefix, action, parsed_args, **kwargs): # pylin | |||
register_cli_argument(scope, 'public_ip_address_allocation', help=None, arg_group='Network', **enum_choice_list(['dynamic', 'static'])) | |||
register_cli_argument(scope, 'public_ip_address_dns_name', help='Globally unique DNS name for a newly created Public IP.', arg_group='Network') | |||
register_cli_argument(scope, 'secrets', multi_ids_type, help='One or many Key Vault secrets as JSON strings or files via \'@<file path>\' containing \'[{ "sourceVault": { "id": "value" }, "vaultCertificates": [{ "certificateUrl": "value", "certificateStore": "cert store name (only on windows)"}] }]\'', type=file_type, completer=FilesCompleter()) | |||
register_cli_argument(scope, 'os_caching', options_list=['--storage-caching', '--os-caching'], arg_group='Storage', help='Storage caching type for the VM OS disk.', **enum_choice_list(CachingTypes)) |
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.
My understanding is we should set Read/Write
to OS Disk for VMSS, as the service default as None
is not favorable
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.
Yes, the latest email says it should be whatever VM is, which is ReadWrite.
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.
Also, I suppressed "None" from the enum for OS caching.
@yugangw-msft changes made |
* Azure/master: (478 commits) vm live test: allow more valid power states on vmss test verifications (Azure#2564) rbac:catch more graph error (Azure#2567) appservice: support to create plan when create a webapp (Azure#2550) Update storage tests (Azure#2556) Change PEP8 check filter from whitelist to blacklist (Azure#2557) Add scenario tests documentation (Azure#2555) [ACS] Adding support for configuring a default ACS cluster (Azure#2554) [ACS] Provide a short name alias for the orchestrator type flag (Azure#2553) Sql Import/Export CLI commands and test (Azure#2538) Fix format bug. (Azure#2549) [VM/VMSS] Improved disk caching support (Azure#2522) VM/VMSS: incorporate credentials validation logic used by portal (Azure#2537) Script that creates packaged releases package archive (Azure#2508) Adding alias for defaults flag (Azure#2540) Add wait commands and --no-wait support (Azure#2524) choice list outside of named arguments (Azure#2521) Fixed test failure in test_sql_db_mgmt. (Azure#2530) core: support login using service principal with a cert (Azure#2457) Add note about being in preview (Azure#2512) vm:fix distro check mechanism used by disk encryption (Azure#2511) ...
Closes #2497.
vm/vmss create
for OS disk caching. The existing--storage-caching
exists alongside--os-caching
. The intent is that--storage-caching
will be deprecated and removed in the future. (Issue 'vm/vmss create': deprecate and remove --storage-caching #2523)--data-caching
tovm/vmss create
which is the caching type used for data disks.--caching
tovm disk/vmss disk/vm unmanaged-disk attach
command.