summaryrefslogtreecommitdiff
path: root/nova/tests/unit/scheduler/client
diff options
context:
space:
mode:
authorChris Dent <cdent@anticdent.org>2018-04-16 17:55:46 +0100
committerChris Dent <cdent@anticdent.org>2018-04-17 18:18:43 +0100
commit2c51688558504f2e8ce80bac06642772be67b2a9 (patch)
tree1b91f8d1a5e30a0debbecc66b199ed834f63045f /nova/tests/unit/scheduler/client
parentfb0b785169e5e422b06e82f2eb58e68f6d2008b3 (diff)
downloadnova-2c51688558504f2e8ce80bac06642772be67b2a9.tar.gz
Parse forbidden in extra_specs
Accept forbidden traits in the processing of extra_specs, with the format of: trait:CUSTOM_MAGIC=forbidden This will be transformed into required=!CUSTOM_MAGIC when the traits are assembled into a request to GET /allocation_candidates. Implements blueprint forbidden-traits-in-nova Change-Id: I31e609aef47d2fea03f279e4bfdd30f072d062b4
Diffstat (limited to 'nova/tests/unit/scheduler/client')
-rw-r--r--nova/tests/unit/scheduler/client/test_report.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py
index c809dff098..8f0ec5b23a 100644
--- a/nova/tests/unit/scheduler/client/test_report.py
+++ b/nova/tests/unit/scheduler/client/test_report.py
@@ -1421,14 +1421,18 @@ class TestProviderOperations(SchedulerReportClientTestCase):
'resources1:DISK_GB': '30',
'trait:CUSTOM_TRAIT1': 'required',
'trait:CUSTOM_TRAIT2': 'preferred',
+ 'trait:CUSTOM_TRAIT3': 'forbidden',
+ 'trait:CUSTOM_TRAIT4': 'forbidden',
})
resources.get_request_group(None).member_of = [
('agg1', 'agg2', 'agg3'), ('agg1', 'agg2')]
expected_path = '/allocation_candidates'
- expected_query = {'resources': ['MEMORY_MB:1024,VCPU:1'],
- 'required': ['CUSTOM_TRAIT1'],
- 'member_of': ['in:agg1,agg2'],
- 'limit': ['1000']}
+ expected_query = {
+ 'resources': ['MEMORY_MB:1024,VCPU:1'],
+ 'required': ['CUSTOM_TRAIT1,!CUSTOM_TRAIT3,!CUSTOM_TRAIT4'],
+ 'member_of': ['in:agg1,agg2'],
+ 'limit': ['1000']
+ }
resp_mock.json.return_value = json_data
self.ks_adap_mock.get.return_value = resp_mock