From 692cbd2ace21e19ffd7cbf7e942107b02dc9d2ec Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 29 Mar 2019 14:03:53 +0100 Subject: [PATCH] Make 'noop' the explicit default of default_storage_interface Currently it's implicit in the driver_factory code. This change makes it more visible and removes the special case from driver_factory. Change-Id: I1502ab22171110d48dee29827e0fda9171a74931 --- ironic/common/driver_factory.py | 6 ------ ironic/conf/default.py | 1 + ironic/tests/base.py | 5 ++++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ironic/common/driver_factory.py b/ironic/common/driver_factory.py index 3f7c2fe2cf..3d9f42bd83 100644 --- a/ironic/common/driver_factory.py +++ b/ironic/common/driver_factory.py @@ -131,15 +131,9 @@ def default_interface(hw_type, interface_type, :raises: NoValidDefaultForInterface if no default interface can be found. """ factory = _INTERFACE_LOADERS[interface_type] - # Explicit interface defaults - additional_defaults = { - 'storage': 'noop' - } # The fallback default from the configuration 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: # Check that the default is correct for this type diff --git a/ironic/conf/default.py b/ironic/conf/default.py index bc0043139d..b43e3bbe05 100644 --- a/ironic/conf/default.py +++ b/ironic/conf/default.py @@ -151,6 +151,7 @@ driver_opts = [ default=['cinder', 'noop'], help=_ENABLED_IFACE_HELP.format('storage')), cfg.StrOpt('default_storage_interface', + default='noop', help=_DEFAULT_IFACE_HELP.format('storage')), cfg.ListOpt('enabled_vendor_interfaces', default=['ipmitool', 'no-vendor'], diff --git a/ironic/tests/base.py b/ironic/tests/base.py index ef55148df9..dabcb7ba4c 100644 --- a/ironic/tests/base.py +++ b/ironic/tests/base.py @@ -131,6 +131,8 @@ class TestCase(oslo_test_base.BaseTestCase): self.config(enabled_hardware_types=['fake-hardware', 'manual-management']) for iface in drivers_base.ALL_INTERFACES: + default = None + # Restore some reasonable defaults if iface == 'network': values = ['flat', 'noop', 'neutron'] @@ -142,12 +144,13 @@ class TestCase(oslo_test_base.BaseTestCase): elif iface == 'boot': values.append('pxe') elif iface == 'storage': + default = 'noop' values.append('noop') elif iface not in {'network', 'power', 'management'}: values.append('no-%s' % iface) self.config(**{'enabled_%s_interfaces' % iface: values, - 'default_%s_interface' % iface: None}) + 'default_%s_interface' % iface: default}) self.set_defaults(host='fake-mini', debug=True) self.set_defaults(connection="sqlite://",