Add option to control ironic network interfaces

When deploying on IPv6 stateful ironic must use the
neutron network interface driver. This because we need
to configure neutron service ports (provisioning, cleaning
etc.) with multiple ip addresses for certain UEFI firmware
and chainloading combinations (iPXE -> Ironic IPA) to work.

Closes-Bug: #1864491
Change-Id: I5a9890ccb95a21b95f488cd7a5b5fd1a6cdff38b
(cherry picked from commit af4721b7fa)
This commit is contained in:
Harald Jensås 2019-12-20 04:09:30 +01:00
parent 74060d33e4
commit 63f4078bf8
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

@ -143,6 +143,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'}