Merge "Make 'noop' the explicit default of default_storage_interface"

This commit is contained in:
Zuul 2019-04-01 08:14:08 +00:00 committed by Gerrit Code Review
commit 1b68717964
3 changed files with 5 additions and 7 deletions

View File

@ -131,15 +131,9 @@ def default_interface(hw_type, interface_type,
:raises: NoValidDefaultForInterface if no default interface can be found. :raises: NoValidDefaultForInterface if no default interface can be found.
""" """
factory = _INTERFACE_LOADERS[interface_type] factory = _INTERFACE_LOADERS[interface_type]
# Explicit interface defaults
additional_defaults = {
'storage': 'noop'
}
# The fallback default from the configuration # The fallback default from the configuration
impl_name = getattr(CONF, 'default_%s_interface' % interface_type) impl_name = getattr(CONF, 'default_%s_interface' % interface_type)
if impl_name is None:
impl_name = additional_defaults.get(interface_type)
if impl_name is not None: if impl_name is not None:
# Check that the default is correct for this type # Check that the default is correct for this type

View File

@ -151,6 +151,7 @@ driver_opts = [
default=['cinder', 'noop'], default=['cinder', 'noop'],
help=_ENABLED_IFACE_HELP.format('storage')), help=_ENABLED_IFACE_HELP.format('storage')),
cfg.StrOpt('default_storage_interface', cfg.StrOpt('default_storage_interface',
default='noop',
help=_DEFAULT_IFACE_HELP.format('storage')), help=_DEFAULT_IFACE_HELP.format('storage')),
cfg.ListOpt('enabled_vendor_interfaces', cfg.ListOpt('enabled_vendor_interfaces',
default=['ipmitool', 'no-vendor'], default=['ipmitool', 'no-vendor'],

View File

@ -131,6 +131,8 @@ class TestCase(oslo_test_base.BaseTestCase):
self.config(enabled_hardware_types=['fake-hardware', self.config(enabled_hardware_types=['fake-hardware',
'manual-management']) 'manual-management'])
for iface in drivers_base.ALL_INTERFACES: for iface in drivers_base.ALL_INTERFACES:
default = None
# Restore some reasonable defaults # Restore some reasonable defaults
if iface == 'network': if iface == 'network':
values = ['flat', 'noop', 'neutron'] values = ['flat', 'noop', 'neutron']
@ -142,12 +144,13 @@ class TestCase(oslo_test_base.BaseTestCase):
elif iface == 'boot': elif iface == 'boot':
values.append('pxe') values.append('pxe')
elif iface == 'storage': elif iface == 'storage':
default = 'noop'
values.append('noop') values.append('noop')
elif iface not in {'network', 'power', 'management'}: elif iface not in {'network', 'power', 'management'}:
values.append('no-%s' % iface) values.append('no-%s' % iface)
self.config(**{'enabled_%s_interfaces' % iface: values, self.config(**{'enabled_%s_interfaces' % iface: values,
'default_%s_interface' % iface: None}) 'default_%s_interface' % iface: default})
self.set_defaults(host='fake-mini', self.set_defaults(host='fake-mini',
debug=True) debug=True)
self.set_defaults(connection="sqlite://", self.set_defaults(connection="sqlite://",