Merge "Fix NoneType has no attribute get error"
This commit is contained in:
commit
42e6848551
@ -278,7 +278,7 @@ class FilterScheduler(driver.Scheduler):
|
||||
# takes 'resource_XX' and 'volume_XX' as input respectively, copying
|
||||
# 'volume_XX' to 'resource_XX' will make both filters happy.
|
||||
volume_type = request_spec.get("volume_type")
|
||||
resource_type = request_spec.get("volume_type", {})
|
||||
resource_type = volume_type if volume_type is not None else {}
|
||||
|
||||
config_options = self._get_configuration_options()
|
||||
|
||||
|
@ -46,7 +46,8 @@ class FakeHostManager(host_manager.HostManager):
|
||||
'thick_provisioning_support': True,
|
||||
'reserved_percentage': 10,
|
||||
'volume_backend_name': 'lvm1',
|
||||
'timestamp': UTC_NOW},
|
||||
'timestamp': UTC_NOW,
|
||||
'multiattach': True},
|
||||
'host2': {'total_capacity_gb': 2048,
|
||||
'free_capacity_gb': 300,
|
||||
'allocated_capacity_gb': 1748,
|
||||
|
@ -334,15 +334,18 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
return (sched, fake_context)
|
||||
|
||||
@ddt.data(None, {'name': 'LVM_iSCSI'})
|
||||
@mock.patch('cinder.db.service_get_all')
|
||||
def test_backend_passes_filters_happy_day(self, _mock_service_get_topic):
|
||||
def test_backend_passes_filters_happy_day(self, volume_type,
|
||||
_mock_service_get_topic):
|
||||
"""Do a successful pass through of with backend_passes_filters()."""
|
||||
sched, ctx = self._backend_passes_filters_setup(
|
||||
_mock_service_get_topic)
|
||||
request_spec = {'volume_id': fake.VOLUME_ID,
|
||||
'volume_type': {'name': 'LVM_iSCSI'},
|
||||
'volume_type': volume_type,
|
||||
'volume_properties': {'project_id': 1,
|
||||
'size': 1}}
|
||||
'size': 1,
|
||||
'multiattach': True}}
|
||||
request_spec = objects.RequestSpec.from_primitives(request_spec)
|
||||
ret_host = sched.backend_passes_filters(ctx, 'host1#lvm1',
|
||||
request_spec, {})
|
||||
|
Loading…
Reference in New Issue
Block a user