diff --git a/ironic/drivers/modules/network/neutron.py b/ironic/drivers/modules/network/neutron.py index 2503ea84b6..bf4b635362 100644 --- a/ironic/drivers/modules/network/neutron.py +++ b/ironic/drivers/modules/network/neutron.py @@ -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) diff --git a/ironic/tests/unit/drivers/modules/network/test_neutron.py b/ironic/tests/unit/drivers/modules/network/test_neutron.py index 665a674a67..71ce579847 100644 --- a/ironic/tests/unit/drivers/modules/network/test_neutron.py +++ b/ironic/tests/unit/drivers/modules/network/test_neutron.py @@ -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), diff --git a/releasenotes/notes/permit-conductor-to-start-without-neutron-networks-d4aa21654f9c07bf.yaml b/releasenotes/notes/permit-conductor-to-start-without-neutron-networks-d4aa21654f9c07bf.yaml new file mode 100644 index 0000000000..6e4f7e2501 --- /dev/null +++ b/releasenotes/notes/permit-conductor-to-start-without-neutron-networks-d4aa21654f9c07bf.yaml @@ -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.