-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[SQL] 'az sql mi update: Add
--tier and
--family` parameters to change hw generation
#11852
[SQL] 'az sql mi update: Add
--tier and
--family` parameters to change hw generation
#11852
Conversation
@Juliehzl, please help review it, thanks. |
@@ -2134,6 +2134,12 @@ def _find_managed_instance_sku_from_capabilities(cli_ctx, location, sku): | |||
# Find family level capability, based on requested sku properties | |||
family_capability = _find_family_capability(sku, edition_capability.supported_families) | |||
|
|||
# Check whether hardware family is being changed to a deprecated hardware family | |||
if not is_instance_create: | |||
if current_sku_family == 'Gen5' and 'Gen4' in family_capability.sku: |
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.
Why is this being done client-side instead of server-side (MI provision operation authorizer)? These sorts of policy decisions should not be coded into CLI
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.
The idea was to fast fail if a customer tries to change hardware family to a deprecated hardware family. Synced with PM, and we agreed to remove this check as you suggested. Thanks
'family', | ||
'name', | ||
'tier', | ||
]) |
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.
Can you show the output of az sql mi create -h
and az sql mi update -h
, and make sure that sku-related params have same UX as az sql db create -h
?
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.
src/azure-cli/HISTORY.rst
Outdated
@@ -74,6 +74,10 @@ Release History | |||
* Add new parameters `--enable-delete-retention` and `--delete-retention-days` to support managing delete retention policy for storage account blob-service-properties. | |||
|
|||
|
|||
**SQL** |
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 rearrange the release note in the right position and use active voice for your commands
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.
Fixed
@@ -1156,7 +1156,8 @@ def _configure_security_policy_storage_params(arg_ctx): | |||
|
|||
c.argument('tier', | |||
arg_type=tier_param_type, | |||
help='The edition component of the sku. Allowed values: GeneralPurpose, BusinessCritical.') | |||
help='The edition component of the sku. Allowed values include:' |
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 use get_enum_types() for allowed values.
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. I've done the same thing for family 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.
@@ -559,6 +559,8 @@ | |||
examples: | |||
- name: Updates a mi with specified parameters and with identity | |||
text: az sql mi update -g mygroup -n myinstance -i -p mypassword --license-type mylicensetype --capacity vcorecapacity --storage storagesize | |||
- name: Updates mi edition and hardware family |
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.
Updates -> Update
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.
Fixed
@@ -559,6 +559,8 @@ | |||
examples: | |||
- name: Updates a mi with specified parameters and with identity | |||
text: az sql mi update -g mygroup -n myinstance -i -p mypassword --license-type mylicensetype --capacity vcorecapacity --storage storagesize | |||
- name: Updates mi edition and hardware family | |||
text: az sql mi update -g mygroup -n myinstance -tier GeneralPurpose -family Gen5 |
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.
It should be --tier and --family.
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.
Corrected. Thanks
: Add
--tier and
--family` parameters to change hw generation
Please follow above template for your PR title in future. |
Fixing _help.py Using get_enum_type() for allowed values
c055879
to
c2f1037
Compare
Fixing _help.py Using get_enum_type() for allowed values
…/v-nestan/azure-cli into nemanjas/mi_change_hw_generation Merging with latest.
@@ -56,7 +56,9 @@ | |||
ComputeModelType, | |||
DatabaseCapabilitiesAdditionalDetails, | |||
ElasticPoolCapabilitiesAdditionalDetails, | |||
FailoverPolicyType | |||
FailoverPolicyType, | |||
ManagedInstanceTiers, |
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.
style nitpick: It should be singular, i.g. ManagedInstanceTier
& ManagedInstanceFamily
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've removed those because they are not needed any more since I've removed get_enum_type()
help='The compute generation component of the sku. ' | ||
'Allowed values include: Gen4, Gen5.') | ||
arg_type=mi_family_param_type, | ||
help='The compute generation component of the sku.') |
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.
Does get_enum_type()
throw error if you don't specify one of the allowed values? This will prevent forward compatibility (i.e. when we release Gen1234, customers will not be able to manually type it in until they download newer CLI version) - this has previously been a frustration for SQL DB customers. We should allow customer to type in anything, then if we validate it must be against a dynamic list (e.g. capabilities API) and NOT a hardcoded list.
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've checked now and it does throws an error. For example
az sql mi update --subscription "DS-CloudLifter_jovanc_R&D_60843" --resource-group 201tmpl --name nestan-testing109 --family Gen52
az sql mi update: 'Gen52' is not a valid value for '--family'. See 'az sql mi update --help'.
The most similar choice to 'Gen52' is:
Gen5
I'll remove the get_enum_type :)
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.
Removed
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.
Thanks for pointing this up
return sku | ||
|
||
if not _any_sku_values_specified(sku): | ||
if is_instance_create and not _any_sku_values_specified(sku): |
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.
Why is is_instance_create
logic needed?
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.
You are right it is redundant.
The idea was to protect from getting a default sku name when sku components are not entered during update SLO
However, since SKU for existing instance is populated before this method is called, default sku will not be taken for update SLO.
I'll remove it
instance, | ||
administrator_login_password=None, | ||
license_type=None, | ||
vcores=None, | ||
storage_size_in_gb=None, | ||
assign_identity=False, | ||
proxy_override=None, | ||
public_data_endpoint_enabled=None): | ||
public_data_endpoint_enabled=None, | ||
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.
In the interest of alignment & reducing overall complexity, would it make sense to use same syntax as db_update function (i.e. split it up into components):
tier=None,
family=None,
capacity=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.
Just remembered that MI has vcores property, not capacity. Blergh
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'll replace sku with tier and family. I'll omit the third component of sku because it is not needed
@@ -2211,6 +2221,16 @@ def managed_instance_update( | |||
instance.proxy_override = ( | |||
proxy_override or instance.proxy_override) | |||
|
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.
Should you set sku.name = None
here?
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 it makes sense to null out the sku name here, because there is no requested sku name, and you don't yet know what the sku name will be (it will be found based on tier & family).
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, it makes sense to set it to None
here
Removing redundant parameter `is_instance_create` Replacing `sku` with `tier` and `family` in `managed_instance_update` for consistency with db_update
add to S165. |
src/azure-cli/HISTORY.rst
Outdated
@@ -51,6 +51,10 @@ Release History | |||
* `az storage remove`: Change `--inlcude` and `--exclude` parameters to `--include-path`, `--include-pattern`, `--exclude-path` and`--exclude-pattern` parameters | |||
* `az storage sync`: Add `--include-pattern`, `--exclude-path` and`--exclude-pattern` parameters | |||
|
|||
**SQL** | |||
|
|||
* Update az sql mi update with two new properties tier and family. |
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.
nit: please format this string little better. It sound weird: "Update az sql mi update". Also "properties: tier and family"
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. Thanks
@@ -2098,21 +2098,18 @@ def encryption_protector_update( | |||
# sql managed instance # | |||
############################################### | |||
|
|||
|
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.
removing this line is causing validation to fail, please return it
@@ -2211,6 +2211,16 @@ def managed_instance_update( | |||
instance.proxy_override = ( | |||
proxy_override or instance.proxy_override) | |||
|
|||
instance.sku.name = 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.
tiny nit: consider commenting the reason why you do this, since it would not be obvious when first reading
…w_generation Syncing with the latest q
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 in general. Please make CI pass.
This change adds support for changing existing managed instance hardware generation.
TFS item link
History Notes:
[SQL] Update SQL Managed Instance cmdlet
az sql mi update
with two new parameters: tier and family.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).
I adhere to the Command Guidelines.