Merge "Add option to control ironic network interfaces"

This commit is contained in:
Zuul 2020-03-12 19:28:16 +00:00 committed by Gerrit Code Review
commit 4e6e37e2ce
5 changed files with 47 additions and 3 deletions

View File

@ -0,0 +1,8 @@
---
features:
- |
The network interface drivers for the Baremetal service on the undercloud
is now configurable. New undercloud.conf options
``enabled_network_interfaces`` (Default: ``flat``) and
``default_network_interface`` (Default: ``flat``) control the enabled
network interface and the default network interface when enrolling nodes.

View File

@ -362,6 +362,24 @@ class UndercloudConfig(StandaloneConfig):
help=(_('IPv6 address configuration mode for the '
'undercloud provisioning network.'))
),
cfg.ListOpt('ironic_enabled_network_interfaces',
default=['flat'],
help=(_('Enabled ironic network interface '
'implementations. Each hardware type must '
'have at least one valid implementation '
'enabled.'))
),
cfg.StrOpt('ironic_default_network_interface',
default='flat',
choices=[
('flat', 'Use one flat provider network.'),
('neutron', 'Ironic interacts with Neutron to '
'enable other network types and '
'advanced networking features.')
],
help=(_('Ironic network interface implementation to '
'use by default.'))
),
]
return self.sort_opts(_base_opts + _opts)

View File

@ -52,6 +52,8 @@ class TestUndercloudConfig(base.TestCase):
'ipa_otp',
'ipv6_address_mode',
'ipxe_enabled',
'ironic_default_network_interface',
'ironic_enabled_network_interfaces',
'local_interface',
'local_ip',
'local_mtu',
@ -119,6 +121,8 @@ class TestUndercloudConfig(base.TestCase):
'ipa_otp',
'ipv6_address_mode',
'ipxe_enabled',
'ironic_default_network_interface',
'ironic_enabled_network_interfaces',
'local_interface',
'local_ip',
'local_mtu',

View File

@ -40,14 +40,19 @@ class TestProcessDriversAndHardwareTypes(base.TestCase):
def setUp(self):
super(TestProcessDriversAndHardwareTypes, self).setUp()
self.conf = mock.Mock(**{key: getattr(undercloud_config.CONF, key)
for key in ('enabled_hardware_types',
'enable_node_discovery',
'discovery_default_driver')})
for key in (
'enabled_hardware_types',
'enable_node_discovery',
'discovery_default_driver',
'ironic_enabled_network_interfaces',
'ironic_default_network_interface')})
def test_defaults(self):
env = {}
undercloud_config._process_drivers_and_hardware_types(self.conf, env)
self.assertEqual({
'IronicEnabledNetworkInterfaces': ['flat'],
'IronicDefaultNetworkInterface': 'flat',
'IronicEnabledHardwareTypes': ['idrac', 'ilo', 'ipmi', 'redfish'],
'IronicEnabledBootInterfaces': ['ilo-pxe', 'ipxe', 'pxe'],
'IronicEnabledBiosInterfaces': ['ilo', 'no-bios', 'redfish'],
@ -70,6 +75,8 @@ class TestProcessDriversAndHardwareTypes(base.TestCase):
undercloud_config._process_drivers_and_hardware_types(self.conf, env)
self.assertEqual({
'IronicEnabledNetworkInterfaces': ['flat'],
'IronicDefaultNetworkInterface': 'flat',
# ipmi added because it's the default discovery driver
'IronicEnabledHardwareTypes': ['ipmi', 'redfish'],
'IronicEnabledBootInterfaces': ['ipxe', 'pxe'],
@ -96,6 +103,8 @@ class TestProcessDriversAndHardwareTypes(base.TestCase):
undercloud_config._process_drivers_and_hardware_types(self.conf, env)
self.assertEqual({
'IronicEnabledNetworkInterfaces': ['flat'],
'IronicDefaultNetworkInterface': 'flat',
'IronicEnabledHardwareTypes': ['fake-hardware', 'idrac', 'ilo',
'ipmi', 'irmc', 'redfish', 'snmp',
'staging-ovirt', 'xclarity'],

View File

@ -142,6 +142,11 @@ def _process_drivers_and_hardware_types(conf, env):
env['IronicInspectorDiscoveryDefaultDriver'] = (
conf.discovery_default_driver)
env['IronicEnabledNetworkInterfaces'] = \
conf.ironic_enabled_network_interfaces
env['IronicDefaultNetworkInterface'] = \
conf.ironic_default_network_interface
# In most cases power and management interfaces are called the same, so we
# use one variable for them.
mgmt_interfaces = {'fake', 'ipmitool'}