summaryrefslogtreecommitdiff
path: root/placement-api-ref
diff options
context:
space:
mode:
authorChris Dent <cdent@anticdent.org>2017-11-19 12:09:38 +0000
committerChris Dent <cdent@anticdent.org>2017-12-20 20:08:39 +0000
commit4a97bbd8248d9db7936404b66c133331316ee4b5 (patch)
tree961e0f8d9705159864d40b4080fb31774f0f7dd5 /placement-api-ref
parent609ddc2244bf9ba84d66cced52e7d4e2987ec669 (diff)
downloadnova-4a97bbd8248d9db7936404b66c133331316ee4b5.tar.gz
[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
Diffstat (limited to 'placement-api-ref')
-rw-r--r--placement-api-ref/source/allocation_candidates.inc1
-rw-r--r--placement-api-ref/source/parameters.yaml8
2 files changed, 9 insertions, 0 deletions
diff --git a/placement-api-ref/source/allocation_candidates.inc b/placement-api-ref/source/allocation_candidates.inc
index 0a07a7c9e3..9ed805e62e 100644
--- a/placement-api-ref/source/allocation_candidates.inc
+++ b/placement-api-ref/source/allocation_candidates.inc
@@ -30,6 +30,7 @@ Request
.. rest_parameters:: parameters.yaml
- resources: resources_query_required
+ - limit: allocation_candidates_limit
Response (microversions 1.12 - )
--------------------------------
diff --git a/placement-api-ref/source/parameters.yaml b/placement-api-ref/source/parameters.yaml
index db90567288..e4d57e701b 100644
--- a/placement-api-ref/source/parameters.yaml
+++ b/placement-api-ref/source/parameters.yaml
@@ -42,6 +42,14 @@ trait_name:
The name of a trait.
# variables in query
+allocation_candidates_limit:
+ type: integer
+ in: query
+ required: false
+ min_version: 1.16
+ description: >
+ A positive integer used to limit the maximum number of allocation
+ candidates returned in the response.
member_of:
type: string
in: query