Skip to content

Conversation

@qwordy
Copy link
Member

@qwordy qwordy commented Mar 31, 2021

Description

Resolve #15988
Extended location for Compute RP
Add a new parameter --edge-zone.
Extended location also applies to Storage and Network.
PR for Storage: #17528

I need 2020-12-01 Python SDK! I even need 2021-03-01 SDK in other features. I plan to iterate fast to avoid potential conflict. It is not necessary to put and merge all features in one PR.

Done:
az disk create
az image create
az snapshot create
az vm create
az vmss create
az vm image list-offers
az vm image list-skus

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@qwordy qwordy requested a review from Juliehzl April 1, 2021 02:53
@yungezz yungezz requested a review from houk-ms April 1, 2021 05:04
@yungezz yungezz added the Compute az vm/vmss/image/disk/snapshot label Apr 1, 2021
@qwordy qwordy marked this pull request as ready for review April 1, 2021 07:33
@houk-ms
Copy link
Contributor

houk-ms commented Apr 1, 2021

Is this feature urgent? I prefer to wait for SDK release to keep consistent experience on all these commands.

if namespace.edge_zone:
namespace.edge_zone = {
'name': namespace.edge_zone,
'type': 'EdgeZone'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why a fixed type here? Service only supports the type now?

Copy link
Member Author

Choose a reason for hiding this comment

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

--edge-zone has an implicit meaning of EdgeZone type. The value is name.

for scope in ['disk create', 'snapshot create']:
with self.argument_context(scope) as c:
c.argument('source', help='source to create the disk/snapshot from, including unmanaged blob uri, managed disk id or name, or snapshot id or name')
c.argument('edge_zone', edge_zone_type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any pre-defined values of the edge zone? Is any string available?



def validate_edge_zone(cmd, namespace): # pylint: disable=unused-argument
if namespace.edge_zone:
Copy link
Contributor

Choose a reason for hiding this comment

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

edge_zone can be any string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The definition is a string. In practice, service surely does not allow all strings.

c.argument('sku', arg_type=snapshot_sku)
c.argument('incremental', arg_type=get_three_state_flag(), min_api='2019-03-01',
help='Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed')
c.ignore('edge_zone')
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need to ignore the variable here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Python SDK is not released.

raise CLIError(error)


def validate_edge_zone(cmd, namespace): # pylint: disable=unused-argument
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to add such global validation here because it is easy to pass edge zone information in your command code as shown in

params.extended_location = ExtendedLocation(name=edge_zone,
and the exposed parameter is extended location not edge zone.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. I removed it from core.

Copy link
Contributor

@Juliehzl Juliehzl left a comment

Choose a reason for hiding this comment

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

The feature should be release on 5/4 with storage, network and PSH team. Please not merge it in this sprint.

In addition, the feature is in preview and we need to add preview tag. The global parameter in my PR add such flag globally.

edge_zone_type = CLIArgumentType(help='The name of edge zone.', is_preview=True)

@qwordy
Copy link
Member Author

qwordy commented Apr 6, 2021

@Juliehzl OK. I added preview label. OK. Release together. I can test it without error. I thought it was ready.

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

Labels

Compute az vm/vmss/image/disk/snapshot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compute] Add optional parameter --EdgeZone to support extended locations

4 participants