Skip to content

[Compute] vmss create/update: add --terminate-notification and --terminate-notification-time parameters to support terminate scheduled event configurability. Issue #10124#10391

Closed
qwordy wants to merge 0 commit into
Azure:devfrom
qwordy:dev

Conversation

@qwordy
Copy link
Copy Markdown
Member

@qwordy qwordy commented Sep 2, 2019

[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.

@qwordy qwordy self-assigned this Sep 2, 2019
Copy link
Copy Markdown
Contributor

@yugangw-msft yugangw-msft left a comment

Choose a reason for hiding this comment

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

Great start, Feiyue! I left a few minor comments. Please also author an example and verify it

Comment thread src/azure-cli/azure/cli/command_modules/vm/_params.py Outdated
Copy link
Copy Markdown
Contributor

@mmyyrroonn mmyyrroonn left a comment

Choose a reason for hiding this comment

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

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.

@yugangw-msft
Copy link
Copy Markdown
Contributor

I cannot understand, how can the customer disable this field after creating it.

Good point. I believe "az vmss update" should handle it through the generic updater, but let us cross check.

Comment thread src/azure-cli/HISTORY.rst Outdated
@qwordy
Copy link
Copy Markdown
Member Author

qwordy commented Sep 2, 2019

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.
  1. Good idea.
  2. update --set command. But it's better to provide a dedicated parameter.
  3. OK
  4. OK
    Thank you for your review.

@qwordy qwordy requested a review from Juliehzl September 3, 2019 07:13
@qwordy qwordy changed the title [VM] vmss create: --terminate-notification, add terminate scheduled event configurability #10124 [Compute] vmss create/update: add --terminate-notification and --terminate-notification-time parameters to support terminate scheduled event configurability. Issue #10124 Sep 3, 2019

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(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Usually we use enable_terminate_notification

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

@qwordy qwordy Sep 4, 2019

Choose a reason for hiding this comment

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

Abbreviation is not urgent and is not pervasive now. If this parameter is used heavily, we can add it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

three_flags_arguments supports user just inputs --terminate-notification without any value followed. So it's quite confusing to use this argument like that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I followed the pattern here.

c.argument('accelerated_networking', arg_type=get_three_state_flag(),

https://docs.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest#az-vmss-create

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's time to escalate.
@yugangw-msft What's the best practice?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just in suggestion, for storage module, we also use enable_xxx for such argument to enable a flag or argument.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@yugangw-msft yugangw-msft Sep 4, 2019

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you for your reviews.

@qwordy qwordy requested review from yonzhan and zikalino September 4, 2019 06:25
if secrets:
secrets = _merge_secrets([validate_file_or_dict(secret) for secret in secrets])

validate_terminate_notification(terminate_notification, terminate_notification_time)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It seems reasonable.

azure-mgmt-cdn==3.1.0
azure-mgmt-cognitiveservices==5.0.0
azure-mgmt-compute==6.0.0
azure-mgmt-compute==7.0.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you declare package upgrade in changelog?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can you declare package upgrade in changelog?

OK

Comment thread src/azure-cli/HISTORY.rst Outdated

**Compute**

* vmss create/update: Add --terminate-notification and --terminate-notification-time parameters to support terminate scheduled event configurability.
Copy link
Copy Markdown
Contributor

@yugangw-msft yugangw-msft Sep 4, 2019

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. It is turned off by default. OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants