From d584b008394276a731611f7ede398e40dbf5f71a Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Wed, 24 Jan 2018 14:15:56 +0800 Subject: [PATCH] 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 Change-Id: I366b97ef3c141834f48949700edb968a7c7c4167 --- .../openstack/placement/handlers/allocation_candidate.py | 2 +- nova/api/openstack/placement/util.py | 6 +++--- placement-api-ref/source/parameters.yaml | 5 +++-- .../allocation-candidates-traits-1adf079ed0c6563c.yaml | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/nova/api/openstack/placement/handlers/allocation_candidate.py b/nova/api/openstack/placement/handlers/allocation_candidate.py index 5d30ffd95..391113fca 100644 --- a/nova/api/openstack/placement/handlers/allocation_candidate.py +++ b/nova/api/openstack/placement/handlers/allocation_candidate.py @@ -196,7 +196,7 @@ def _transform_allocation_candidates(alloc_cands, want_version): include_traits = want_version.matches((1, 17)) p_sums = _transform_provider_summaries(alloc_cands.provider_summaries, - include_traits) + include_traits=include_traits) return { 'allocation_requests': a_reqs, 'provider_summaries': p_sums, diff --git a/nova/api/openstack/placement/util.py b/nova/api/openstack/placement/util.py index 30961cd10..588f1b913 100644 --- a/nova/api/openstack/placement/util.py +++ b/nova/api/openstack/placement/util.py @@ -306,9 +306,9 @@ def normalize_traits_qs_param(val): """ ret = set(substr.strip() for substr in val.split(',')) if not all(trait for trait in ret): - msg = _('Invalid query string parameters: Expected \'required\' ' - 'parameter value of the form: HW_CPU_X86_VMX,CUSTOM_MAGIC. ' - 'Got: "%s"') % val + msg = _("Invalid query string parameters: Expected 'required' " + "parameter value of the form: HW_CPU_X86_VMX,CUSTOM_MAGIC. " + "Got: %s") % val raise webob.exc.HTTPBadRequest(msg) return ret diff --git a/placement-api-ref/source/parameters.yaml b/placement-api-ref/source/parameters.yaml index 80e35417d..6c1e87bdd 100644 --- a/placement-api-ref/source/parameters.yaml +++ b/placement-api-ref/source/parameters.yaml @@ -56,7 +56,7 @@ allocation_candidates_required: required: false min_version: 1.17 description: > - Accepts a list of traits separated by `,`. Allocation requests in the + Accepts a list of comma-separated traits. Allocation requests in the response will be for resource providers that have capacity for all requested resources and the set of those resource providers will *collectively* contain all of the required traits. @@ -252,7 +252,8 @@ provider_summaries: description: > A dictionary keyed by resource provider UUID, of dictionaries of inventory/capacity information. The list of traits - the resource provider has associated with it is included in version `1.17`. + the resource provider has associated with it is included in version `1.17` + and above. reserved: &reserved type: integer in: body diff --git a/releasenotes/notes/allocation-candidates-traits-1adf079ed0c6563c.yaml b/releasenotes/notes/allocation-candidates-traits-1adf079ed0c6563c.yaml index af7aae46a..eceb9b3ae 100644 --- a/releasenotes/notes/allocation-candidates-traits-1adf079ed0c6563c.yaml +++ b/releasenotes/notes/allocation-candidates-traits-1adf079ed0c6563c.yaml @@ -6,5 +6,5 @@ features: separated by ``,``, which is used to further limit the list of allocation requests to resource providers that have the capacity to fulfill the requested resources AND *collectively* have all of the required traits - associated with them. In the same microversion, the candidate attached - traits returned in the provider summary. + associated with them. In the same microversion, the provider summary + includes the traits associated with each provider.