Skip to content

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

Open
Jeremy Lee (legit-ninja) wants to merge 6 commits into
vexxhost:mainfrom
samaritanark:contrib/manila-quotas-2b5
Open

Jeremy Lee (legit-ninja) wants to merge 6 commits into
vexxhost:mainfrom
samaritanark:contrib/manila-quotas-2b5

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 Manila changes are the last three commits. Merge #161 first.

Summary

Add Manila project and share-type quota monitoring, and report share inventory once per logical share instead of once per share instance. Manila capacity metrics move to bytes.

Metrics

  • Twelve project quota families, openstack_sharev2_quota_{shares,bytes,snapshots,snapshot_bytes,share_networks,share_replicas,replica_bytes,share_groups,share_group_snapshots,backups,backup_bytes,per_share_bytes}, with tenant, tenant_id, domain_id and type labels. type is limit, in_use or reserved; quota_per_share_bytes has limit only.
  • Six share-type families, openstack_sharev2_share_type_quota_{shares,bytes,snapshots,snapshot_bytes,share_replicas,replica_bytes}, adding share_type (UUID) and share_type_name labels.
  • openstack_sharev2_quota_up: quota collection health, separate from openstack_sharev2_up.

Behavior

  • Usage comes from Manila's persisted accounting. Project totals sum per-user rows without a share-type scope; share-type totals are kept separate because they describe the same allocations. Signed usage and reservations are kept as int64.
  • Limits resolve from configured defaults, then the persisted default class, then project overrides, then share-type overrides. Share-type limits inherit the project limit when no type override exists. User overrides are used to discover projects but never replace project limits.
  • A share type with a NULL name (deleted or missing) has its type series omitted without failing collection; project totals are unaffected.
  • Query failures omit quota data with quota_up=0. Invalid project or share-type limits omit the affected scope and set quota_up=0 while keeping valid scopes.
  • Inventory uses ShareGetInventory: one row per logical share, including shares without instances and retained soft-deleted shares. Status, share type and availability zone come from the same representative instance.

Configuration

  • --quota.defaults-file gains an optional manila section with all twelve Manila [quota] settings (in GiB). Without it, Manila 2025.2 defaults are assumed with a warning.
  • --manila.quota-query-timeout / MANILA_QUOTA_QUERY_TIMEOUT (default 5s): shared deadline for the six quota reads.

Breaking metric changes

openstack_sharev2_share_gb is renamed to openstack_sharev2_share_bytes with the same labels and no alias. All Manila capacity values are GiB × 2^30; only an unlimited (-1) limit stays unscaled. The inventory size label stays in GiB. Status and count metric names and labels are unchanged, but a replicated or migrating share now produces one series instead of one per instance.

Dependencies

Tests

  • Unit tests for defaults, precedence, raw accounting with large totals, NULL share-type names, inventory selection and timeouts.
  • End-to-end coverage of all quota resources, project and share-type values, exact labels, signed reservations, the per-share limit in bytes, logical inventory uniqueness, zero-instance and retained shares, and absence of the old capacity family.

Built and tested (go build, go vet, go test -race ./...) against openstackdb with #11 and #12 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>
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>
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