Reverse-specification of osc-placement — branch stable/2026.2
Branch
stable/2026.2@402610a21872(4.9.1+ 2 maintenance commits) — repository https://opendev.org/openstack/osc-placement — analysed on 2026-10-28
- Scope: all non-test code (13 modules, 2,436 lines). The functional tests serve as the source of the client contract.
- References are
file:linerelative to the repository root. [inferred] marks a statement that was not followed to the end in the code.
Files of this specification
| File | Content |
|---|---|
| 01-cli-commands_stable-2026.2.md | shared mechanics (plugin, microversion negotiation, client-side checks), the 31 commands with their class, minimum microversion and Placement calls |
| 02-errors_stable-2026.2.md | translation of Placement 4xx into osc-lib exceptions, client-side errors, negotiation errors |
| 03-interactions_stable-2026.2.md | Keystone (catalog) and Placement (headers, query strings, read-modify-write sequences) |
| 04-scenarios_stable-2026.2.md | 4 scenarios: negotiation, allocation set, inventory on an aggregate, allocation candidates with groups |
| 05-async-processing_stable-2026.2.md | none (short-lived CLI process) |
| 06-change-history_stable-2026.2.md | 2 maintenance commits; nothing to carry over |
| 07-rewrite-pack_stable-2026.2.md | client contract osc-placement → Placement, and a replayable suite of 928 invocations (928/928 identical against Placement) |
Overview
osc-placement is the plugin of the openstack command line that drives Placement: resource providers, inventories, allocations, resource classes, traits, aggregates, usages and allocation candidates. Each command:
- checks the microversion locally;
- sends one to three REST calls to Placement (through keystoneauth and the Keystone catalog);
- displays the result.
| Process | Entry point | Role |
|---|---|---|
openstack (python-openstackclient) | entry points openstack.cli.extension = placement and openstack.placement.v1 (setup.cfg) | loads the plugin and its 31 commands (osc_placement/plugin.py) |
Key figures
31 commands; 21 microversions declared plus negotiation (osc_placement/version.py:21-55); default negotiated microversion 1.29; 0 exception classes of its own; 0 background processing. Tests: 160 functional tests, 928 CLI invocations, 1,381 HTTP exchanges recorded.
Points of attention
- Default 1.29: negotiation never goes above 1.29. Consumer types (1.38) and
in:traits (1.39) need--os-placement-api-version. - Read-modify-write without retry:
allocation set,inventory set --amend,trait setandaggregate setread the generation, then write. A concurrent change gives a 409 shown to the user. - Dependency on the Placement error format:
errors[0].detail(last line) on every 4xx, anderrors[0].max_versionon a 406. Without them, the CLI crashes withKeyError. - **
inventory set --aggregateis not atomic**: partial failures, reported at the end.
Blind spots / [inferred]
- The behaviour of osc-lib and openstackclient (argument parsing, output formatters) was not analysed: only their use by the plugin.
- Negotiation against a server older than 1.29 is described from the code, not exercised by the recorded tests.
Source: reverse-spec-osc-placement/00-summary_stable-2026.2.md. The _rewrite/ and _inventory/ files are not published on the site.