From 52dbe134abcc20a17e9ee60e4a268df4fa073c5d Mon Sep 17 00:00:00 2001 From: Harald Jensas Date: Thu, 8 Feb 2018 14:47:38 +0100 Subject: [PATCH] Make routed networks optional Closes-Bug: #1749671 Change-Id: Ieabb2ded33ec0c0b68f21c9afa16a9baddc61393 --- instack_undercloud/tests/test_undercloud.py | 1 + instack_undercloud/undercloud.py | 22 +++++++++++++++++---- undercloud.conf.sample | 6 +++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/instack_undercloud/tests/test_undercloud.py b/instack_undercloud/tests/test_undercloud.py index b06888d5c..4733cd2dc 100644 --- a/instack_undercloud/tests/test_undercloud.py +++ b/instack_undercloud/tests/test_undercloud.py @@ -42,6 +42,7 @@ class BaseTestCase(base.BaseTestCase): super(BaseTestCase, self).setUp() self.logger = self.useFixture(log.ConfigureLogging()).logger self.conf = self.useFixture(config_fixture.Config()) + self.conf.config(enable_routed_networks=True) # ctlplane-subnet - config group options self.grp0 = cfg.OptGroup(name='ctlplane-subnet', title='ctlplane-subnet') diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 5f43056a5..d0aa8e57d 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -405,6 +405,9 @@ _opts = [ help=('List of additional architectures enabled in your cloud ' 'environment. The list of supported values is: %s' % ' '.join(validator.SUPPORTED_ARCHITECTURES))), + cfg.BoolOpt('enable_routed_networks', + default=False, + help=('Enable support for routed ctlplane networks.')), ] # Routed subnets @@ -2216,10 +2219,21 @@ def _config_neutron_segments_and_subnets(sdk, ctlplane_id): else: segment = _neutron_segment_create(sdk, name, ctlplane_id, phynet) - subnet = _neutron_subnet_create(sdk, ctlplane_id, s.cidr, - s.gateway, host_routes, - allocation_pool, name, - segment.id) + if CONF.enable_routed_networks: + subnet = _neutron_subnet_create(sdk, ctlplane_id, s.cidr, + s.gateway, host_routes, + allocation_pool, name, + segment.id) + elif name == CONF.local_subnet: + # Create subnet with segment_id: None if routed networks + # is not enabled. + # TODO(hjensas): Deprecate option and remove this once + # tripleo-ui can support managing baremetal port + # attributes. + subnet = _neutron_subnet_create(sdk, ctlplane_id, s.cidr, + s.gateway, host_routes, + allocation_pool, name, + None) # If the subnet is IPv6 we need to start a router so that router # advertisments are sent out for stateless IP addressing to work. diff --git a/undercloud.conf.sample b/undercloud.conf.sample index e6de248c4..6854bc5c2 100644 --- a/undercloud.conf.sample +++ b/undercloud.conf.sample @@ -192,7 +192,8 @@ # undercloud. (boolean value) #enable_container_images_build = true -# Whether to install the Octavia client. (boolean value) +# Whether to install the Octavia client in the Undercloud. (boolean +# value) #enable_octavia = false # One Time Password to register Undercloud node with an IPA server. @@ -233,6 +234,9 @@ # The list of supported values is: ppc64le (list value) #additional_architectures = +# Enable support for routed ctlplane networks. (boolean value) +#enable_routed_networks = false + [auth]