diff options
author | shilpa <shilpa.devharakar@nttdata.com> | 2019-07-15 14:23:15 +0530 |
---|---|---|
committer | Shilpa <Shilpa.Devharakar@nttdata.com> | 2019-09-09 20:16:32 +0000 |
commit | 3c8af001d540efa271102987c79889ed0b849820 (patch) | |
tree | fd9e91e40fdddfcf0059fadfb79447b5d19bdd85 /nova/scheduler | |
parent | 8126ba54d164ac94d817e8b8f4bad6f89cece6b1 (diff) | |
download | nova-3c8af001d540efa271102987c79889ed0b849820.tar.gz |
Nova object changes for forbidden aggregates request filter
This patch modifies Nova objects that will allow Destination object to
store list of forbidden aggregates that placement should ignore in
'GET /allocation_candidates' API at microversion 1.32, including the
code to generate the placement querystring syntax from them.
Change-Id: Ic2bcee40b41c97170a8603b27b935113f0633de7
Implements: blueprint placement-req-filter-forbidden-aggregates
Diffstat (limited to 'nova/scheduler')
-rw-r--r-- | nova/scheduler/client/report.py | 4 | ||||
-rw-r--r-- | nova/scheduler/utils.py | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py index 73e50917a6..9477f5fa0c 100644 --- a/nova/scheduler/client/report.py +++ b/nova/scheduler/client/report.py @@ -41,9 +41,9 @@ from nova import utils CONF = nova.conf.CONF LOG = logging.getLogger(__name__) WARN_EVERY = 10 +NEGATIVE_MEMBER_OF_VERSION = '1.32' RESHAPER_VERSION = '1.30' CONSUMER_GENERATION_VERSION = '1.28' -INTREE_AC_VERSION = '1.31' ALLOW_RESERVED_EQUAL_TOTAL_INVENTORY_VERSION = '1.26' POST_RPS_RETURNS_PAYLOAD_API_VERSION = '1.20' AGGREGATE_GENERATION_VERSION = '1.19' @@ -291,7 +291,7 @@ class SchedulerReportClient(object): """ # Note that claim_resources() will use this version as well to # make allocations by `PUT /allocations/{consumer_uuid}` - version = INTREE_AC_VERSION + version = NEGATIVE_MEMBER_OF_VERSION qparams = resources.to_querystring() url = "/allocation_candidates?%s" % qparams resp = self.get(url, version=version, diff --git a/nova/scheduler/utils.py b/nova/scheduler/utils.py index 9ed4878289..0ffa54003b 100644 --- a/nova/scheduler/utils.py +++ b/nova/scheduler/utils.py @@ -304,6 +304,7 @@ class ResourceRequest(object): forbidden_traits = request_group.forbidden_traits aggregates = request_group.aggregates in_tree = request_group.in_tree + forbidden_aggregates = request_group.forbidden_aggregates resource_query = ",".join( sorted("%s:%s" % (rc, amount) @@ -327,6 +328,12 @@ class ResourceRequest(object): qs_params.extend(sorted(aggs)) if in_tree: qs_params.append(('in_tree%s' % suffix, in_tree)) + if forbidden_aggregates: + # member_ofN is a list of aggregate uuids. We need a + # tuple of ('member_ofN, '!in:uuid,uuid,...'). + forbidden_aggs = '!in:' + ','.join( + sorted(forbidden_aggregates)) + qs_params.append(('member_of%s' % suffix, forbidden_aggs)) return qs_params if self._limit is not None: @@ -479,6 +486,9 @@ def resources_from_request_spec(ctxt, spec_obj, host_manager): # [['aggA', 'aggB'], ['aggC']] grp.aggregates = [ored.split(',') for ored in destination.aggregates] + if destination.forbidden_aggregates: + grp = res_req.get_request_group(None) + grp.forbidden_aggregates |= destination.forbidden_aggregates if 'force_hosts' in spec_obj and spec_obj.force_hosts: # Prioritize the value from requested_destination just in case |