Browse Source

Merge "Fix DriverFilter to accept None volume type" into stable/stein

changes/41/746041/1
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
ce4c86a1a3
2 changed files with 6 additions and 3 deletions
  1. +1
    -1
      cinder/scheduler/filters/driver_filter.py
  2. +5
    -2
      cinder/tests/unit/scheduler/test_host_filters.py

+ 1
- 1
cinder/scheduler/filters/driver_filter.py View File

@@ -114,7 +114,7 @@ class DriverFilter(filters.BaseBackendFilter):

qos_specs = filter_properties.get('qos_specs', {})

volume_type = filter_properties.get('volume_type', {})
volume_type = filter_properties.get('volume_type', {}) or {}
extra_specs = volume_type.get('extra_specs', {})

request_spec = filter_properties.get('request_spec', {})


+ 5
- 2
cinder/tests/unit/scheduler/test_host_filters.py View File

@@ -819,8 +819,11 @@ class AffinityFilterTestCase(BackendFiltersTestCase):
self.assertFalse(filt_cls.backend_passes(host, filter_properties))


@ddt.ddt
class DriverFilterTestCase(BackendFiltersTestCase):
def test_passing_function(self):
@ddt.data({'volume_type': {}}, {'volume_type': None})
@ddt.unpack
def test_passing_function(self, volume_type):
filt_cls = self.class_map['DriverFilter']()
host1 = fakes.FakeBackendState(
'host1', {
@@ -829,7 +832,7 @@ class DriverFilterTestCase(BackendFiltersTestCase):
}
})

filter_properties = {'volume_type': {}}
filter_properties = {'volume_type': volume_type}

self.assertTrue(filt_cls.backend_passes(host1, filter_properties))



Loading…
Cancel
Save