[Compute] vmss create/update: add --terminate-notification and --terminate-notification-time parameters to support terminate scheduled event configurability. Issue #10124#10391
Conversation
yugangw-msft
left a comment
There was a problem hiding this comment.
Great start, Feiyue! I left a few minor comments. Please also author an example and verify it
mmyyrroonn
left a comment
There was a problem hiding this comment.
Hi. Just some comments
- Now, only the create command support this argument. However, the related issue also ask for update command. Please add this argument into update command.
- I cannot understand, how can the customer disable this field after creating it.
- At least, please add a test command for this argument.
- You can include "Fix #10124", "Fixes #10124" or "Fixed #10124" in your first comment. When this PR is merged, the related issue will be closed automatically.
Good point. I believe "az vmss update" should handle it through the generic updater, but let us cross check. |
|
|
|
||
| for scope in ['vmss create', 'vmss update']: | ||
| with self.argument_context(scope) as c: | ||
| c.argument('terminate_notification', min_api='2019-03-01', arg_type=get_three_state_flag(), |
There was a problem hiding this comment.
Usually we use enable_terminate_notification
There was a problem hiding this comment.
https://docs.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-create
vm create has 3 boolean parameters now. They don't have a enable_ prefix.
enable_ means you can only enable it. You can not pass true or false.
There was a problem hiding this comment.
Abbreviation is not urgent and is not pervasive now. If this parameter is used heavily, we can add it.
There was a problem hiding this comment.
three_flags_arguments supports user just inputs --terminate-notification without any value followed. So it's quite confusing to use this argument like that.
There was a problem hiding this comment.
I followed the pattern here.
https://docs.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest#az-vmss-create
There was a problem hiding this comment.
It's time to escalate.
@yugangw-msft What's the best practice?
There was a problem hiding this comment.
Just in suggestion, for storage module, we also use enable_xxx for such argument to enable a flag or argument.
There was a problem hiding this comment.
There is one parameter called "--ultra-ssd-enabled" in below doc:
https://docs.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest#az-vmss-create
Maybe you can also follow that pattern and use "terminate-notification-enabled" so that these two parameters can share the same prefix "terminate-notification".
@yugangw-msft can make the call for name convention.
There was a problem hiding this comment.
let us go with enable_terminate_notification. accelerated_networking is a questionable naming which I probably should not have named that way.
(EDIT) also, let us use this opportunity to unify the naming decision on such arguments moving forward. I cross checked a few commands, right now we are not consistent, i am seeing enable_xxx, xxx_enabled, or just xxx
There was a problem hiding this comment.
Thank you for your reviews.
| if secrets: | ||
| secrets = _merge_secrets([validate_file_or_dict(secret) for secret in secrets]) | ||
|
|
||
| validate_terminate_notification(terminate_notification, terminate_notification_time) |
There was a problem hiding this comment.
This validate function is used only for arguments, right? If yes, it should be executed before command handler and you should specify your argument validator in argument context like https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/vm/_params.py#L238.
| azure-mgmt-cdn==3.1.0 | ||
| azure-mgmt-cognitiveservices==5.0.0 | ||
| azure-mgmt-compute==6.0.0 | ||
| azure-mgmt-compute==7.0.0 |
There was a problem hiding this comment.
Can you declare package upgrade in changelog?
There was a problem hiding this comment.
Can you declare package upgrade in changelog?
OK
|
|
||
| **Compute** | ||
|
|
||
| * vmss create/update: Add --terminate-notification and --terminate-notification-time parameters to support terminate scheduled event configurability. |
There was a problem hiding this comment.
For create command, we probably only need --terminate-notification-time. As long as the time argument value is provided, CLI should enable the notification. I assume by default the notification is off, right? For update, we can expose both. The context is the create command has got too many fields, hence I recommend we use a bit more defaults.
There was a problem hiding this comment.
Yes. It is turned off by default. OK.
[VM] vmss create: --terminate-notification, add terminate scheduled event configurability #10124
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.