Skip to content

feat(neutron): add reservation-aware quota monitoring and project identity - #164

Open
Jeremy Lee (legit-ninja) wants to merge 5 commits into
vexxhost:mainfrom
samaritanark:contrib/neutron-quotas-2b6
Open

Jeremy Lee (legit-ninja) wants to merge 5 commits into
vexxhost:mainfrom
samaritanark:contrib/neutron-quotas-2b6

Conversation

@legit-ninja

@legit-ninja Jeremy Lee (legit-ninja) commented Dec 2, 2026 •

Copy link
Copy Markdown

Note

Stacked on #161 (Octavia quotas, shared quota configuration). This branch contains #161's three commits; the Neutron changes are the last two commits. Merge #161 first.

Summary

Make the existing Neutron quota metrics report real reservations and configurable defaults, add project identity labels, and add quota collection health.

Changes

  • The nine openstack_neutron_quota_* families (floatingip, network, port, rbac_policy, router, security_group, security_group_rule, subnet, subnetpool) keep type="limit|used|reserved". reserved was always 0; it now sums active reservations from reservations/resourcedeltas with expiration >= UTC_TIMESTAMP() on the database clock, as Neutron's DbQuotaNoLockDriver does.
  • The families gain tenant_id and domain_id labels alongside tenant and type.
  • Defaults are no longer hard-coded: they come from a neutron section in --quota.defaults-file. Zero is valid and negative values normalize to -1. Without the section, Neutron 2025.2 defaults are assumed with a logged warning.
  • New openstack_neutron_quota_up (collection health, separate from openstack_neutron_up) and openstack_neutron_quota_skipped_records (records that failed validation on a successful scrape).
  • New --neutron.quota-query-timeout / NEUTRON_QUOTA_QUERY_TIMEOUT (default 5s) shared deadline. Project metadata refresh is bounded by the remaining deadline through a new project.Resolver.AllProjectsContext; other collectors keep their existing refresh behavior.

Behavior

  • Usage counts rows owned directly by each project. Empty-string owners are treated as system-owned and skipped.
  • NULL overrides, duplicate quota or usage rows, duplicate or invalid reservation deltas, and negative usage omit all three measurements for the affected project and resource, and are counted in quota_skipped_records.
  • Query failures, timeouts and invalid configuration emit quota_up=0 with no quota samples. Invalid Neutron configuration does not stop the exporter or other metrics.
  • Logs carry controlled reasons, allowlisted resource names and hashed owner IDs, not raw driver errors or configuration content. Keystone connection and refresh errors elsewhere now log only the error type.

Breaking metric changes

Adding tenant_id and domain_id changes series identity for all nine quota families. Selectors on type="used" still work, but exact label matches, joins, aggregations and recording rules need review. reserved values are no longer always zero.

Dependencies

Tests

  • Unit tests for defaults parsing, reservation aggregation, record validation, skipped-record counting, timeouts and the resolver deadline.
  • Startup tests for Neutron configuration handling.
  • End-to-end coverage of reservations through the exporter's HTTP endpoint.

Built and tested (go build, go vet, go test -race ./...) against openstackdb with #11 and #13 applied. MariaDB end-to-end tests have not yet been run against the rebased dependency.

Export stored limits and rebuilt usage for seven Octavia resources, with
project metadata fallback, defaults configuration, bounded SQL reads and
separate quota health. Preserve inventory and other service registration.

Requires the public openstackdb quota APIs; keep the canonical dependency
until those APIs are accepted upstream. Validate through an external Go
workspace in the meantime.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Extend the existing full-exporter fixture with distinct resource counts,
nullable and explicit limits, deleted resources and an idle project.
Assert every quota family and preserve existing service assertions.

Integration-tag vet passes; native MariaDB execution is pending because
Docker is unavailable in the preparation environment.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: David Hulick <dave.hulick@gmail.com>
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.

2 participants