Skip to content

feat(networking): Neutron QoS family (policy + bandwidth-limit / DSCP / minimum-bandwidth rules) - #19

Merged
PF9-pushkar merged 1 commit into
mainfrom
feat/networking-qos
Jul 12, 2026
Merged

feat(networking): Neutron QoS family (policy + bandwidth-limit / DSCP / minimum-bandwidth rules)#19
PF9-pushkar merged 1 commit into
mainfrom
feat/networking-qos

Conversation

@PF9-pushkar

Copy link
Copy Markdown
Collaborator

Summary

Adds the Neutron QoS resource family (Phase 3), ported from terraform-provider-openstack v3.4.0 and adapted to the terraform-plugin-framework:

Resource Purpose
pcd_networking_qos_policy QoS policy (shared, is_default, tags)
pcd_networking_qos_bandwidth_limit_rule max_kbps / max_burst_kbps / direction
pcd_networking_qos_dscp_marking_rule dscp_mark
pcd_networking_qos_minimum_bandwidth_rule min_kbps / direction
pcd_networking_qos_policy (data source) look up a policy by id or name

Design notes

  • No new client/subcategory. The family lives in the existing internal/services/networking package and reuses configureClient, replaceTags, and NetworkV2Client. Docs land under the existing Networking subcategory.
  • Rules are nested under a policy. qos_policy_id is Required + ForceNew; rules import via a composite <qos_policy_id>/<rule_id> ID (helper splitQoSRuleID). The policy imports by bare ID.
  • Update asymmetry. Policy/rule UpdateOpts set pointer fields only when the planned value differs from state, so a boolean flipped to false is still sent (verified against gophercloud BuildRequestBody).

Adversarial review — two real bugs found and fixed

Three review passes (state-consistency, gophercloud API usage, import/data-source/registration) ran before this PR. Two confirmed findings, both fixed in this branch:

  1. Wrong tags path (high). Policy tags were written to the policies attributes-tags collection; the QoS policy collection is qos/policies (/v2.0/qos/policies/{id}/tags). Tag writes would have 404'd against a real cloud. Fixed at both call sites; confirmed against upstream terraform-provider-openstack and gophercloud's resourcePath.
  2. Discarded notFound after create/update (correctness). Create/Update ignored the readInto not-found bool; a read-after-write 404 would persist unknown computed values → "Provider produced inconsistent result after apply". Now a post-write 404 is surfaced as an error in all four resources.

The import/data-source/registration pass returned no findings.

Testing

  • go build, go vet, gofmt, golangci-lint — all clean (0 issues).
  • Unit tests pass; terraform fmt clean on examples.
  • Full-tree acceptance test (TestAccNetworkingQoS_tree): policy + all three rule types + data source, an in-place rename/rate-change step, and policy import — not run live this session (CE lab credentials unavailable). QoS depends only on the Neutron qos extension (no compute/storage backend), so it should pass on the fresh CE lab; see DECISIONS.md.

Docs / examples

  • Examples for every resource (with import.sh) and the data source.
  • docs/ regenerated via make generate (not committed — generated on demand).
  • CHANGELOG and DECISIONS updated.

Add the network QoS resources ported from terraform-provider-openstack:

- pcd_networking_qos_policy (shared/is_default/tags)
- pcd_networking_qos_bandwidth_limit_rule
- pcd_networking_qos_dscp_marking_rule
- pcd_networking_qos_minimum_bandwidth_rule
- pcd_networking_qos_policy data source (lookup by id or name)

Rules are nested under a policy (qos_policy_id is ForceNew) and imported by a
composite <qos_policy_id>/<rule_id> ID. The family reuses the existing
networking package's configureClient/replaceTags/NetworkV2Client, so it needs
no new service client or docs subcategory.

Policy tags use the "qos/policies" attributes-tags path (the QoS policy
collection lives at /v2.0/qos/policies, not /v2.0/policies). Create and Update
treat a 404 on the immediate read-back as an error rather than persisting
unknown computed values.

Includes a full-tree acceptance test (policy + all three rules + data source +
import), examples, and CHANGELOG/DECISIONS entries.
@PF9-pushkar
PF9-pushkar merged commit d112b8a into main Jul 12, 2026
4 checks passed
@PF9-pushkar
PF9-pushkar deleted the feat/networking-qos branch July 12, 2026 17:45
PF9-pushkar added a commit that referenced this pull request Jul 14, 2026
feat(networking): Neutron QoS family (policy + bandwidth-limit / DSCP / minimum-bandwidth rules)
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