Merge "Fix driver filter to not check share_backend_name"

This commit is contained in:
Zuul 2019-03-14 21:56:27 +00:00 committed by Gerrit Code Review
commit 5966d00909
3 changed files with 9 additions and 33 deletions

View File

@ -50,23 +50,9 @@ class DriverFilter(base_host.BaseHostFilter):
Returns a tuple in the format (filter_passing, filter_invalid).
Both values are booleans.
"""
host_stats = stats['host_stats']
extra_specs = stats['extra_specs']
# Check that the share types match
if extra_specs is None or 'share_backend_name' not in extra_specs:
LOG.warning("No 'share_backend_name' key in extra_specs. "
"Skipping share backend name check.")
elif (extra_specs['share_backend_name'] !=
host_stats['share_backend_name']):
LOG.warning("Share backend names do not match: '%(target)s' "
"vs '%(current)s' :: Skipping.",
{'target': extra_specs['share_backend_name'],
'current': host_stats['share_backend_name']})
return False
if stats['filter_function'] is None:
LOG.warning("Filter function not set :: passing host.")
LOG.debug("Filter function not set :: passing host.")
return True
try:

View File

@ -82,24 +82,6 @@ class HostFiltersTestCase(test.TestCase):
self.assertTrue(self.filter.host_passes(host1, filter_properties))
def test_extra_specs_wrong_backend(self):
host1 = fakes.FakeHostState(
'host1', {
'capabilities': {
'filter_function': '1 == 1',
}
})
filter_properties = {
'share_type': {
'extra_specs': {
'share_backend_name': 'foo',
}
}
}
self.assertFalse(self.filter.host_passes(host1, filter_properties))
def test_function_extra_spec_replacement(self):
host1 = fakes.FakeHostState(
'host1', {

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixed the driver filter to not check for hard equality between the
share_backend_name and the name reported by the host as it defeats the
purpose of the capabilities filter giving the ability to use "<in>"
selection operator in the extra-spec. Refer to `Launchpad bug 1815700
<https://bugs.launchpad.net/manila/+bug/1815700>`_ for more details.