73 Commits

Author SHA1 Message Date
Zuul
6e7c17fb33 Merge "[placement] api-ref: Fix a missing response code" 2018-03-01 12:56:21 +00:00
Zuul
1fc8dba189 Merge "rp: GET /resource_providers?required=<traits>" 2018-02-26 13:24:13 +00:00
Eric Fried
77341128a1 rp: GET /resource_providers?required=<traits>
Introduce placement microversion 1.18 with a new ?required=<trait list>
query parameter accepted on the GET /resource_providers API.  Results
are filtered by providers possessing *all* of the specified traits.
Empty/invalid traits result in 400 errors.

Change-Id: I8191c9a390cb02b2a38a3f1c6e29457435994981
blueprint: traits-on-list-resource-providers
2018-02-23 12:08:32 -06:00
Eric Fried
aa96c75b61 Clarify resources query param for /r_p and /a_c
It was pointed out [1] that the semantic difference between how the
`resources` query parameter is handled by GET /resource_providers versus
GET /allocation_candidates is not clear based on the API reference
descriptions, which are identical.  This change set clarifies the
wording for both, making it clear that a) allocations are taking into
account; and b) GET /allocation_candidates is working with groups of
providers that must *collectively* satisfy the resource specification.

[1] https://review.openstack.org/#/c/547056/2/specs/rocky/approved/traits-on-list-resource-providers.rst@33
Change-Id: Ia2a4f8f80ec68dd9c95e084c292a2fe2d6ec1b2d
2018-02-22 16:47:06 +00:00
Takashi NATSUME
2702dca7c0 [placement] api-ref: Fix a missing response code
In "List resource providers" API,
a 400 badRequest is missing in API reference.
So add it.

Change-Id: I92fcbd6bc1477dd0fe6554c0ba631b9cb7d6fa53
Closes-Bug: #1750728
2018-02-21 14:47:59 +09:00
Eric Fried
42b1aeca58 api-ref: Further clarify placement aggregates
Following up on the comments at [1], provide further disambiguation and
clarity on the difference between placement aggregates and nova host
aggregates, with some illustrative examples that include where the
former may be used to represent the latter (as is being proposed via
[2]).

[1] https://review.openstack.org/#/c/539033/1/placement-api-ref/source/aggregates.inc@14
[2] https://review.openstack.org/#/q/bp/placement-mirror-host-aggregates

Change-Id: I53588fca311992f885c4157591232a864b6a86b1
2018-02-16 08:52:30 -06:00
Zuul
356428d372 Merge "api-ref: provide more detail on what a provider aggregate is" 2018-02-16 11:15:12 +00:00
Takashi NATSUME
ccc6a3c009 [placement] Move body examples to an isolated directory
JSON body examples of Placement API reference
are in the same directroy where *.inc files exist.

This patch moves JSON body examples to an isolated directory
in order to make it easier to maintain the API reference.

Change-Id: I8fd587100d22bd10dd4b2b2f1b25c5ecc7fc8537
2018-02-08 21:59:19 +00:00
Zuul
6b461f9471 Merge "placement doc: Conflict caveat for DELETE APIs" 2018-02-07 13:33:29 +00:00
Eric Fried
206a94de19 placement doc: Conflict caveat for DELETE APIs
Since the DELETE /resource_providers/{u}/inventories and .../traits APIs
don't have a way to accept generation, they're not "threadsafe" in the
sense of multiple client threads managing traits/inventories for the
same provider.  This change adds a note to the documentation for these
APIs to this effect, suggesting the use of PUT with empty
traits/inventories instead.

Change-Id: Icfd79cc1f5a912131845a22b4fe900147b19f934
Closes-Bug: #1746373
2018-02-05 17:34:35 +00:00
Eric Fried
3d156c1a26 Doc: Nix os-traits link from POST resource_classes
The placement API reference documentation for POST /resource_classes [1]
said:

The new class must be a custom resource class, prefixed with CUSTOM_ and
distinct from the _standard_ resource classes.

...where _standard_ was a link to os-traits documentation [2]. Since we
don't have os-resource-classes (yet), this change set removes that
linkitude.

[1] https://developer.openstack.org/api-ref/placement/#create-resource-class
[2] https://docs.openstack.org/os-traits/latest/

Change-Id: I15fbed460598b7d603eca48cbaecf1036906f6c7
Closes-Bug: #1747095
2018-02-02 18:00:21 -06:00
He Jie Xu
d584b00839 Fix nits in support traits changes
Addresses the comments from earlier patches:

https://review.openstack.org/535642

https://review.openstack.org/536085

Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>

Change-Id: I366b97ef3c141834f48949700edb968a7c7c4167
2018-01-31 11:07:07 -05:00
Matt Riedemann
60ffec2f89 api-ref: provide more detail on what a provider aggregate is
The description of placement resource provider aggregates is mostly
discussing how they aren't nova's concept of host aggregates, but
doesn't give a very simple description of what they are.

This provides a simple description and the canonical example of a
shared storage pool.

Change-Id: I3b7c6404d364c045f19390e86fd1b747baf11f8c
2018-01-29 17:39:49 -05:00
He Jie Xu
dbd7773e05 placement: support traits in allocation candidates API
This patch add new query parameter `required` to the
`GET /allocation_candidates` API, which is used to filter candidates
with required traits.  The candidate attached traits return in the
provider summary also. Those API changes are added by new microversion.

Also using specific exception TraitNotFound instead of the generic
exception ValueError when invalid traits in the request.

Change-Id: Id821b5b2768dcc698695ba6570c6201e1e9a8233
Implement blueprint add-trait-support-in-allocation-candidates
2018-01-22 22:10:10 +08:00
Stephen Finucane
60e67d315f trivial: Remove crud from 'conf.py'
No need to have any of this here.

Change-Id: I87c291126bdb9bd3c45232e1041fd9355e953955
2018-01-18 10:39:24 +00:00
Stephen Finucane
682e8b479a Fix openstackdocstheme options for api-ref
Initialize the parameter for current openstackdocstheme so that report a
bug feature works and displays all parameter including git URL and SHA.

We need to add openstackdocstheme as extension so that the parameter are
properly initialized. html_context is not needed anymore. The display of
time of last commit is done by openstackdocstheme.

Change-Id: Ic46f5ff6bc42b48ce9de5f5bf3a2193ed75fb063
Closes-Bug: #1743728
2018-01-18 10:38:51 +00:00
Andreas Jaeger
02abc1afaf Fix OpenStack capitalization
Reviewing the Placement API, I noticed wrong OpenStack capitalization.
Fix the docs and some strings as well.

Change-Id: I14a2443687a0d517ece80e794e7ef0d4e165af6f
2018-01-07 12:38:39 +01:00
Chris Dent
ff6d4560fe [placement] Enable limiting GET /allocation_candidates
This adds a limit query parameter to GET
/allocation_candidates?limit=5&resource=VCPU:1

A 'limit' filter is added to the AllocationCandidates. If set, after
the database query has been run to create the allocation requests and
provider summaries, a slice or sample of the allocation requests is
taken to limit the results. The summaries are then filtered to only
include those in the allocation requests.

This method avoids needing to make changes to the generated SQL, the
creation of which is fairly complex, or the database tables. The amount
of data queried is still high in the extreme case, but the amount of
data sent over the wire (as JSON) is shrunk. This is a trade-off that
was discussed in the spec and the discussion surrounding its review.
If it turns out that memory use server-side is an issue we can
investigate changing the SQL.

A configuration setting, [placement]/randomize_allocation_candidates,
is added to allow deployers to declare whether they want the results
to be returned in whatever order the database chooses or a random
order. The default is "False" which is expected to preserve existing
behavior and impose a packing placement strategy.

When the config setting is combined with the limit parameter, if
"True" the limited results are a random sampling from the full
results. If "False", it is a slice from the front.

This is done as a new microversion, 1.16, with updates to docs, a reno
and adjustments to the api history doc.

Change-Id: I5f3d4f49c34fd3cd6b9d2e12b3c3c4cdcb409bec
Implements: bp allocation-candidates-limit
2017-12-20 20:08:39 +00:00
Takashi NATSUME
09f009d65d [placement] Add x-openstack-request-id in API ref
Add the description about 'x-openstack-request-id'
in the request and the response headers.

Change-Id: I6ffdfbacb81660b89d7bf8ba83dbab1aa25a80bd
Closes-Bug: #1733496
2017-12-18 06:02:44 +00:00
Zuul
9ecf7d32e0 Merge "[placement] Add 'Location' parameters in API ref" 2017-12-14 14:26:12 +00:00
Takashi NATSUME
ce525a805f [placement] Fix API reference for microversion 1.14
It is a follow-up for I4db74e4dc682bc03df6ec94cd1c3a5f5dc927a7b.
Fix description of placement microversion 1.14.

Change-Id: I7a7ffc395d444fe7cf0434ea6745dde0dae11ad5
blueprint nested-resource-providers
2017-12-11 11:37:31 +09:00
Takashi NATSUME
3d194baca3 [placement] Add 'Location' parameters in API ref
The 'Location' parameters are missing in the follwoing APIs of
Placement API reference. So add them.

* POST /resource_providers
* POST /resource_classes
* PUT /resource_classes/{name} (microversion 1.7-)
* PUT /traits/{name}

Change-Id: Ieed5cb7d4697472ab46b2e80d6d2df68098c5631
Closes-Bug: #1733329
2017-12-07 21:00:43 +00:00
Stephen Finucane
5734d078fc placement: adds REST API for nested providers
Adds a new microversion (1.14) to the placement REST API for supporting
nested resource providers.

For POST /resource_providers and PUT /resource_providers/{uuid}, a new
optional 'parent_provider_uuid' field is added to the request payload.

For GET /resource_providers/{uuid} responses, the
'parent_provider_uuid' field and a convenience field called
'root_provider_uuid' are provided.

For GET /resource_providers, a new '?in_tree=<rp_uuid>' parameter is
supported. This parameter accepts a UUID of a resource provider. This
will cause the resulting list of resource providers to be only the
providers within the same "provider tree" as the provider identified by
<rp_uuid>

Clients for the placement REST API can specify either
'OpenStack-API-Version: placement 1.14' or 'placement latest' to handle
the new 'parent_provider_uuid' attribute and to query for resource
providers in a provider tree.

Change-Id: I4db74e4dc682bc03df6ec94cd1c3a5f5dc927a7b
blueprint: nested-resource-providers
APIImpact
2017-12-06 10:48:09 -06:00
Zuul
7730395cdf Merge "[placement]Enhance doc for placement allocation list" 2017-12-05 13:32:38 +00:00
Zuul
f79aa34529 Merge "Add description for resource class creation" 2017-12-05 13:16:59 +00:00
Takashi NATSUME
af7149f926 [placement] Add aggregate link note in API ref
The aggregate link has been added in resource provider APIs
since microversion 1.1.
But the note is missing in Placement API reference.
Add the note.

The allocations link is missing in the response example
of "Update resource provider" API.
Add it as well.

Change-Id: I325ff34c8b436429c2a2623cf1fb16b368807d29
Closes-Bug: #1733317
2017-12-04 22:07:33 +00:00
jichenjc
39e8926484 Add description for resource class creation
POST /placement/resource_classes with incorrect format body
of the resource class name lead to something like:

JSON does not validate: u'_FPGA' does not match '^CUSTOM\\_[A-Z0-9_]+$'
with return code 400

we should add this into doc

Change-Id: Iab264f6d731a5f757a992d9bd148e7eb30922b9d
2017-12-02 01:24:37 +00:00
Zuul
2ebc3f79e3 Merge "[placement] Add 'CUSTOM_' prefix description in API ref" 2017-12-01 01:44:01 +00:00
Zuul
58d1dc0c9d Merge "[placement] Fix parameter order in placement API ref" 2017-12-01 01:42:27 +00:00
jichenjc
0900f86b6d [placement]Enhance doc for placement allocation list
add a note about when the non-existing consumer id input result

Change-Id: I2a19d8fe8dda5754112361be5ceac8a0dc747ae9
2017-11-30 20:41:08 +00:00
Takashi NATSUME
13c1a39567 [placement] Fix format in placement API ref
In "Delete traits" API of Placement API reference,
the format of response codes description is wrong.
"409 Conflict if the name to delete has associations with any"
is bold, but "ResourceProvider." is not.
So fix it.

TrivialFix
Change-Id: I963c350bfc339d4db769b0bfd6bba1087fa065e0
2017-11-30 08:36:40 +00:00
Chris Dent
18e6a44f9d [placement] Fix GET PUT /allocations nits
In the review of I49f5680c15413bce27f2abba68b699f3ea95dcdc, a few
non-blocking nits were identified. This change addresses some of
those nits, fixing some typos, clarifying method names and what
microversion is in use at particular times.

Change-Id: Iff15340502ce43eba3b98db26aa0652b1da24504
2017-11-28 12:25:13 +00:00
Chris Dent
a51f5b0d4d [placement] POST /allocations to set allocations for >1 consumers
This provides microversion 1.13 of the placement API, giving the
ability to POST to /allocations to set (or clear) allocations for
more than one consumer uuid.

It builds on the recent work to support a dict-based JSON format
when doing a PUT to /allocations/{consumer_uuid}.

Being able to set allocations for multiple consumers in one request
helps to address race conditions when cleaning up allocations during
move operations in nova.

Clearing allocations is done by setting the 'allocations' key for a
specific consumer to an empty dict.

Updates to placement-api-ref, rest version history and a reno are
included.

Change-Id: I239f33841bb9fcd92b406f979674ae8c5f8d57e3
Implements: bp post-allocations
2017-11-28 12:15:53 +00:00
Zuul
07389edc7e Merge "[placement] Symmetric GET and PUT /allocations/{consumer_uuid}" 2017-11-28 11:09:03 +00:00
Takashi NATSUME
a7c5c06fc1 [placement] Add 'CUSTOM_' prefix description in API ref
In the following resource class APIs,
the name of a resource class must start with 'CUSTOM_'.
If not, the request returns a 'Bad Request (400)' response code.
It should be described in the API reference. So add it.

* POST /resource_classes
* PUT /resource_classes/{name}

Change-Id: I132c532678bb74a460515067187fbf1e30885335
Closes-Bug: #1733308
2017-11-23 21:01:10 +00:00
Takashi NATSUME
74bb0f7453 [placement] Fix parameter order in placement API ref
Optional parameters should be after required paramenters.
Parameters added in microversions should be after
original parameters.
So fix them.

Change-Id: I5e3f5df5601d3747debed273e09a8b9b18046a96
Closes-Bug: #1728557
2017-11-23 21:01:07 +00:00
Chris Dent
88624af48d [placement] Symmetric GET and PUT /allocations/{consumer_uuid}
In a new microversion, 1.12, include project_id and user_id in the
output of GET /allocations/{consumer_uuid} and add JSON schema
to enable PUT to /allocations/{consumer_uuid} using the same dict-based
format for request body that is used in the GET response. In later
commits a similar format will be used in POST /allocations. This
symmetry is general good form and also will make client code a little
easier.

Since GET /allocation_candiates includes objects which are capable
of being PUT to /allocations/{consumer_uuid}, its response body has
been updated as well, to change the 'allocation_requests' object
to use the dict-based format.

Internally to handlers/allocation.py the same method (_set_allocations)
is used for every microversion. Any previous data structure is
transformed into the dict-ish form. This means that pre-existing tests
(like allocation-bad-class.yaml) continue to exercise the problems it
was made for, but needs to be pinned to an older microversion, rather than
being latest.

Info about these changes is added to placement-api-ref,
rest_api_version_history and a reno.

Change-Id: I49f5680c15413bce27f2abba68b699f3ea95dcdc
Implements: bp symmetric-allocations
Closes-Bug: #1708204
2017-11-21 19:39:59 +00:00
Zuul
16e0d58608 Merge "placement: Document in: prefix for ?member_of=" 2017-11-21 15:25:58 +00:00
Eric Fried
319ec7df91 placement: Document request headers in api-ref
Briefly document in the Placement API reference:

a) the use of Content-Type: application/json
b) how to use microversion headers, including a link to the main
Microversions reference.

Change-Id: I60d7b9dfe4f1c50fc50eaf07a04848c220ffcf62
2017-11-20 10:47:12 -06:00
Eric Fried
e4189d1251 placement: Document in: prefix for ?member_of=
The documentation for the member_of query parameter for GET
/resource_providers [1] claims that it accepts a "comma-separated list
of strings representing aggregate uuids".  But it turns out the code [2]
is expecting a single UUID unless the prefix 'in:' is specified.

This change set updates the documentation accordingly.

[1] https://developer.openstack.org/api-ref/placement/#resource-providers
[2] 57728836f2/nova/api/openstack/placement/handlers/resource_provider.py (L229-L233)

Change-Id: I2ec46d767ded5be02cfc73136f2d217f1347662a
Closes-Bug: #1733030
2017-11-17 20:02:40 -06:00
Eric Fried
b57109e47b Update placement api-ref: allocations link in 1.11
Following on [1], this change updates the placement api-ref to include
the allocations link in the sample output for GET
/resource_providers[/uuid].

[1] https://review.openstack.org/499826

Depends-On: I6a1d320ce914926791d5f45e89bf4c601a6b10a0

Change-Id: I161da67258afaccd90df12364153f068ef55a3b1
2017-10-27 15:47:16 +00:00
Jenkins
797dd5451c Merge "api-ref: note the microversions for GET /resource_providers query params" 2017-10-11 11:19:03 +00:00
jichenjc
92bbd2513a Add 400 as error code for resource class delete
DELETE /placement/resource_classes/VCPU
leads to something like:
Cannot delete standard resource class VCPU:

with return code 400, we should add this into doc

actually it returns 2 lines of
Cannot delete standard resource class VCPU:
now, another patch will fix it.

Partial implement blueprint placement-doc-enhancement-queens

Change-Id: I957325bc421033743472cdd4de17d260da942174
2017-09-25 17:54:16 +08:00
Jenkins
a4c917123d Merge "[placement] api-ref GET /traits name:startswith" 2017-09-08 21:29:24 +00:00
Matt Riedemann
90625fc076 api-ref: note the microversions for GET /resource_providers query params
The member_of query parameter was new in 1.3.

The resources query parameter was new in 1.4.

As a result, the 'resources' parameter description used for
allocation_candidates has to be decoupled since the entire
allocation_candidates API was new in 1.10 and is not specified
per parameter.

Change-Id: I6e0688b4a12212ace98a6876132735094df84b77
Closes-Bug: #1716046
2017-09-08 16:02:27 -04:00
Jenkins
e995bd5cea Merge "Typo error about help resource_classes.inc" 2017-09-08 14:28:09 +00:00
kangyufei
b871bda935 Typo error about help resource_classes.inc
Change-Id: I6e61aadecc80f87cd75c1331ab2f725583e9966b
2017-09-08 11:03:00 +08:00
Andreas Jaeger
52c57ca2b8 Fix broken URLs
Fix broken nova URLs that linked to the old developer/nova places and
use the new link instead.

Change-Id: Ideb50626e140201dded19fc82584440f1a407e47
2017-09-07 15:42:31 +02:00
Eric Fried
6bcda0e997 [placement] api-ref GET /traits name:startswith
In the Placement API reference, the GET /traits [1] query parameter
'name' says it accepts a key called 'starts_with'. The actual API
accepts 'startswith' (no underscore).

[1] https://developer.openstack.org/api-ref/placement/#list-traits

Change-Id: I5a1fa51fc751f2492ae6aa2b38893a9e06a26ed1
Closes-Bug: #1714283
2017-08-31 10:27:39 -05:00
Andrey Volkov
bdd6214678 [placement] Add api-ref for allocation_candidates
Change-Id: Id89d7c16ca53938e2bc18e904e8d13477ceb15f7
2017-08-10 11:26:19 +00:00