-
Notifications
You must be signed in to change notification settings - Fork 359
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
networking_quota_v2: Manage quota by region #1177
Conversation
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) { |
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.
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.
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 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.
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) { |
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.
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
Build succeeded.
|
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.
Please let me know if it's ready to be merged.
@ozerovandrei Please merge I'll prep later this week subsequent MRs for using the same func, blockstorage_quota_v2, v3 and compute_quota |
Close #1104
Appends region to networking_quota_v2 resource ID. This allows to manage quotas across regions for the same project.