Merge "Don't ignore 'capabilities' flavor extra_spec"
This commit is contained in:
@@ -37,10 +37,11 @@ class ComputeCapabilitiesFilter(filters.BaseHostFilter):
|
|||||||
for key, req in instance_type['extra_specs'].iteritems():
|
for key, req in instance_type['extra_specs'].iteritems():
|
||||||
# Either not scope format, or in capabilities scope
|
# Either not scope format, or in capabilities scope
|
||||||
scope = key.split(':')
|
scope = key.split(':')
|
||||||
if len(scope) > 1 and scope[0] != "capabilities":
|
if len(scope) > 1:
|
||||||
continue
|
if scope[0] != "capabilities":
|
||||||
elif scope[0] == "capabilities":
|
continue
|
||||||
del scope[0]
|
else:
|
||||||
|
del scope[0]
|
||||||
cap = capabilities
|
cap = capabilities
|
||||||
for index in range(0, len(scope)):
|
for index in range(0, len(scope)):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -795,6 +795,13 @@ class HostFiltersTestCase(test.NoDBTestCase):
|
|||||||
'trust:trusted_host': 'true'},
|
'trust:trusted_host': 'true'},
|
||||||
passes=True)
|
passes=True)
|
||||||
|
|
||||||
|
def test_compute_filter_pass_extra_specs_same_as_scope(self):
|
||||||
|
# Make sure this still works even if the key is the same as the scope
|
||||||
|
self._do_test_compute_filter_extra_specs(
|
||||||
|
ecaps={'capabilities': 1},
|
||||||
|
especs={'capabilities': '1'},
|
||||||
|
passes=True)
|
||||||
|
|
||||||
def test_compute_filter_extra_specs_simple_with_wrong_scope(self):
|
def test_compute_filter_extra_specs_simple_with_wrong_scope(self):
|
||||||
self._do_test_compute_filter_extra_specs(
|
self._do_test_compute_filter_extra_specs(
|
||||||
ecaps={'opt1': 1, 'opt2': 2},
|
ecaps={'opt1': 1, 'opt2': 2},
|
||||||
|
|||||||
Reference in New Issue
Block a user