Skip to content

feat(manila): add quota metrics and logical share inventory - #5

Open
davidhulick wants to merge 3 commits into
contrib/octavia-quotas-2b3from
contrib/manila-quotas-2b5
Open

davidhulick wants to merge 3 commits into
contrib/octavia-quotas-2b3from
contrib/manila-quotas-2b5

Conversation

@davidhulick

Copy link
Copy Markdown

Summary

Add Manila quota monitoring and improve share inventory collection to report logical shares rather than individual share instances.

This change introduces project-level and share-type-level quota metrics, improves quota accounting and health reporting, and converts share capacity metrics to Prometheus base units (bytes).

The implementation uses the current raw quota query APIs from [openstackdb PR #3](samaritanark/openstackdb#3).

Changes

Manila quota monitoring

  • Add 18 Prometheus quota metric families covering shares, snapshots, capacity, replicas, share networks, share groups, backups, and related resources.
  • Report quota limits, in-use values, and reserved amounts at project and supported share-type scopes.
  • Support configured defaults, persisted default quota classes, project overrides, and share-type overrides.
  • Aggregate raw quota usage across users while preserving signed reservations and NULL-as-zero accounting.
  • Keep project and share-type accounting separate to avoid double-counting usage.
  • Include project and domain identity labels without introducing per-user metric cardinality.
  • Add openstack_sharev2_quota_up to distinguish quota collection failures from share inventory failures.
  • Isolate invalid quota scopes where possible without suppressing valid metrics.

Logical share inventory

  • Report one metric record per logical share rather than one per share instance.
  • Include shares without active instances and retained shares.
  • Use the current library's deterministic instance-selection logic for representative share metadata.
  • Preserve existing status and count metrics.
  • Replace openstack_sharev2_share_gb with openstack_sharev2_share_bytes.

Configuration

  • Add Manila quota defaults loading and validation using the existing shared quota defaults file.
  • Add configurable quota query timeouts.
  • Preserve independent quota and inventory collection health.
  • Update README documentation for metrics, configuration, and dependency requirements.

Validation

The implementation received an independent adversarial review, with no critical, high, or medium-severity defects identified.

Completed validation includes:

  • Full Go short test suite: 407 tests/subtests passed.
  • Full Go race-enabled suite: 407 tests/subtests passed.
  • Manila inventory HTTP regression tests: passed without skips.
  • Build, vet, lint, and module verification: passed.
  • Combined public Octavia/Manila library unit and race tests: passed.
  • SQL code generation verification: no changes.
  • Independent accounting oracle: exact agreement with collector output across valid and malformed-accounting scenarios.
  • Targeted mutation testing: 32 of 33 mutations detected.

The remaining mutation concerns test coverage for hardcoded upstream quota defaults; the existing values were independently verified against Manila.

Dependencies

This contribution is stacked on the Octavia exporter contribution in contrib/octavia-quotas-2b3.

It requires the pending public openstackdb contributions:

Validation used a temporary workspace combining these public library contributions.

The committed module currently references openstackdb v0.2.1, which does not contain the required APIs. A dependency update and standalone CI validation will be necessary once compatible upstream revisions are available.

Known limitations

  • The current Manila library API cannot distinguish an active share type with a SQL NULL name from a deleted or missing share type. Type-specific metrics for these records are omitted. A project discovered exclusively through such records may also be omitted unless another quota record or Keystone identifies it. Ordinary named share types are unaffected.
  • Aggregation of raw usage rows now occurs in the exporter rather than through SQL aggregate queries. Query volume and latency should be evaluated against representative Manila deployments before production rollout.

Scope

This PR is limited to Manila quota monitoring, logical share inventory, associated configuration, and tests.

It does not include unrelated Cinder, Neutron, or Nova changes.

Export project and share-type quota accounting with configured defaults,
precedence, bounded database reads and separate collection health. Select
one inventory row per logical share and expose Manila capacities in bytes.
Preserve signed accounting and the unlimited limit sentinel.

Include startup, timeout, accounting, inventory and metric contract tests.
Requires compatible public openstackdb Manila and Octavia APIs; retain the
canonical module dependency pending public dependency reconciliation.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Seed all Manila quota resources with explicit active-row markers. Check
project and share-type values, exact labels, signed reservations and the
64 GiB per-share limit in bytes. Verify logical inventory uniqueness,
zero-instance and retained shares, and absence of the old capacity family.

Preserve existing Octavia and other-service assertions. Integration-tag
vet passes; native execution requires an available Docker provider.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
Use the generated project and share-type queries, accumulating nullable
usage and reservations in signed int64 totals. Keep project accounting
separate and preserve limit precedence and collection health.

Omit NULL-name type scopes without rejecting the scrape; valid empty
names and independent project totals remain visible. Document this API
limitation and cover raw accounting, large totals and current inventory
selection. Recognize the current Manila query in the timeout fixture.

Signed-off-by: David Hulick <dave.hulick@gmail.com>
@davidhulick davidhulick changed the title Contrib/manila quotas 2b5 feat(manila): add quota metrics and logical share inventory Nov 20, 2026
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.

1 participant