Skip to content
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

networking_quota_v2: Manage quota by region #1177

Merged

Conversation

nikParasyr
Copy link
Member

Close #1104

Appends region to networking_quota_v2 resource ID. This allows to manage quotas across regions for the same project.

if err != nil {
return fmt.Errorf("Error creating OpenStack networking client: %s", err)
}

q, err := quotas.Get(networkingClient, d.Id()).Extract()
// update resource ID with region to allow multi-region quota management
if !strings.Contains(d.Id(), region) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this is the preferred way. Changing the id happens "silently" for the user.

A different approach would be to change parseNetworkingQuotaID to allow both project_id and project_id/region but this will lead to inconsistent resource ids as the ones created before this release will have project_id and after this release project_id/region.

Copy link
Member

Choose a reason for hiding this comment

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

I guess having a single preferred way is better.
Also we shouldn't create any issues by changing ID implicitly since this resource won't be deleted because deletion of a quota resource is a no-op action.

@nikParasyr
Copy link
Member Author

I'll make similar PRs for blockstorage_quota_v2 and v3 after this is merged

@@ -73,3 +75,16 @@ func decodeNeutronError(body []byte) (*neutronError, error) {

return &e.NeutronError, nil
}

func parseNetworkingQuotaID(id string) (string, string, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

If we go for the same setup for all quotas this func should be moved to a more generic file if possible and be used by all quota resources

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 22, 2021

Build succeeded.

Copy link
Member

@ozerovandrei ozerovandrei left a comment

Choose a reason for hiding this comment

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

LGTM.

Please let me know if it's ready to be merged.

@nikParasyr
Copy link
Member Author

@ozerovandrei Please merge

I'll prep later this week subsequent MRs for using the same func, blockstorage_quota_v2, v3 and compute_quota

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.

Networking quota cannot be managed by region
2 participants