neutron: do not error if no cleaning/provisioning on launch

In the early days of the neutron network interface, we had a hard
launch failure added to prevent ironic.conf from having a neutron
network configuration which was not valid when the neutron network
interface was in use.

But as time has moved on, these settings became node-settable,
and ironic configuration largely became mutable as well, so they
can always be added after the process has been launched.

But we kept the error being returned. Which doesn't make sense
now that it can always be back-filled into a working state
or just entirely be "user supplied" via the API by an appropriate
user.

Closes-Bug: 2054728
Change-Id: I33e76929ca9bf7869b3b4ef4d6501e692cf0a922
This commit is contained in:
Julia Kreger 2024-02-22 11:45:01 -08:00
parent 0cfe290d15
commit 50ced3a3fa
3 changed files with 15 additions and 24 deletions

View File

@ -33,22 +33,6 @@ class NeutronNetwork(common.NeutronVIFPortIDMixin,
base.NetworkInterface):
"""Neutron v2 network interface"""
def __init__(self):
failures = []
cleaning_net = CONF.neutron.cleaning_network
if not cleaning_net:
failures.append('cleaning_network')
provisioning_net = CONF.neutron.provisioning_network
if not provisioning_net:
failures.append('provisioning_network')
if failures:
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=(_('The following [neutron] group configuration '
'options are missing: %s') % ', '.join(failures)))
def validate(self, task):
"""Validates the network interface.
@ -57,6 +41,8 @@ class NeutronNetwork(common.NeutronVIFPortIDMixin,
is invalid.
:raises: MissingParameterValue, if some parameters are missing.
"""
# NOTE(TheJulia): These are the minimal networks needed for
# the neutron network interface to function.
self.get_cleaning_network_uuid(task)
self.get_provisioning_network_uuid(task)

View File

@ -85,18 +85,14 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
self.interface.port_changed(task, port)
mock_p_changed.assert_called_once_with(self.interface, task, port)
def test_init_incorrect_provisioning_net(self):
self.config(provisioning_network=None, group='neutron')
self.assertRaises(exception.DriverLoadError, neutron.NeutronNetwork)
self.config(provisioning_network=uuidutils.generate_uuid(),
group='neutron')
self.config(cleaning_network=None, group='neutron')
self.assertRaises(exception.DriverLoadError, neutron.NeutronNetwork)
@mock.patch.object(neutron_common, 'validate_network', autospec=True)
def test_validate(self, validate_mock):
with task_manager.acquire(self.context, self.node.id) as task:
self.interface.validate(task)
# NOTE(TheJulia): This tests validates the calls are made.
# When not mocked out completely, since Neutron is consulted
# on validity of the name or UUID as well, the validate_network
# method gets called which rasies a validate parsable error.
self.assertEqual([mock.call(CONF.neutron.cleaning_network,
'cleaning network',
context=task.context),

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes an issue where the conductor service would fail to launch when
the ``neutron`` network_interface setting was enabled, and no global
``cleaning_network`` or ``provisioning_network`` is set in `ironic.conf.`
These settings have long been able to be applied on a per-node basis via
the API. As such, the service can now be started and will error on node
validation calls, as designed for drivers missing networking parameters.