Merge "Fix volume creation with no volume type"
This commit is contained in:
commit
451e4fcda4
@ -270,10 +270,6 @@ class FilterScheduler(driver.Scheduler):
|
|||||||
self._populate_retry(filter_properties,
|
self._populate_retry(filter_properties,
|
||||||
request_spec['volume_properties'])
|
request_spec['volume_properties'])
|
||||||
|
|
||||||
if resource_type is None:
|
|
||||||
msg = _("volume_type cannot be None")
|
|
||||||
raise exception.InvalidVolumeType(reason=msg)
|
|
||||||
|
|
||||||
request_spec_dict = jsonutils.to_primitive(request_spec)
|
request_spec_dict = jsonutils.to_primitive(request_spec)
|
||||||
|
|
||||||
filter_properties.update({'context': context,
|
filter_properties.update({'context': context,
|
||||||
@ -427,7 +423,7 @@ class FilterScheduler(driver.Scheduler):
|
|||||||
if not weighed_hosts:
|
if not weighed_hosts:
|
||||||
LOG.warning(_LW('No weighed hosts found for volume '
|
LOG.warning(_LW('No weighed hosts found for volume '
|
||||||
'with properties: %s'),
|
'with properties: %s'),
|
||||||
filter_properties['request_spec']['volume_type'])
|
filter_properties['request_spec'].get('volume_type'))
|
||||||
return None
|
return None
|
||||||
return self._choose_top_host(weighed_hosts, request_spec)
|
return self._choose_top_host(weighed_hosts, request_spec)
|
||||||
|
|
||||||
|
@ -30,6 +30,10 @@ class CapabilitiesFilter(filters.BaseHostFilter):
|
|||||||
Check that the capabilities provided by the services satisfy
|
Check that the capabilities provided by the services satisfy
|
||||||
the extra specs associated with the resource type.
|
the extra specs associated with the resource type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not resource_type:
|
||||||
|
return True
|
||||||
|
|
||||||
extra_specs = resource_type.get('extra_specs', [])
|
extra_specs = resource_type.get('extra_specs', [])
|
||||||
if not extra_specs:
|
if not extra_specs:
|
||||||
return True
|
return True
|
||||||
|
@ -147,7 +147,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
|||||||
'size': 1},
|
'size': 1},
|
||||||
'volume_id': fake.VOLUME_ID}
|
'volume_id': fake.VOLUME_ID}
|
||||||
request_spec = objects.RequestSpec.from_primitives(request_spec)
|
request_spec = objects.RequestSpec.from_primitives(request_spec)
|
||||||
self.assertRaises(exception.InvalidVolumeType,
|
self.assertRaises(exception.NoValidHost,
|
||||||
sched.schedule_create_volume,
|
sched.schedule_create_volume,
|
||||||
fake_context,
|
fake_context,
|
||||||
request_spec,
|
request_spec,
|
||||||
|
Loading…
Reference in New Issue
Block a user