From 7984d783fa510a9d254e47a72a0fdda46d56eb80 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Fri, 22 Apr 2022 09:07:33 +0200 Subject: [PATCH] Add undercloud_and_charm_setup configure step The neutron ``basic_overcloud_network`` setup job performs both undercloud and charm configuration prior to configuring the overcloud network. The undercloud and charm configuration steps are useful outside the context of OpenStack Neutron. Split undercloud and charm setup into a new configure step. --- zaza/openstack/charm_tests/neutron/setup.py | 41 +++++++++++++++------ zaza/openstack/configure/network.py | 22 +++++++---- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/setup.py b/zaza/openstack/charm_tests/neutron/setup.py index ba913da..1402c8f 100644 --- a/zaza/openstack/charm_tests/neutron/setup.py +++ b/zaza/openstack/charm_tests/neutron/setup.py @@ -69,29 +69,19 @@ DEFAULT_UNDERCLOUD_NETWORK_CONFIG = { } -def basic_overcloud_network(limit_gws=None): - """Run setup for neutron networking. - - Configure the following: - The overcloud network using subnet pools +def undercloud_and_charm_setup(limit_gws=None): + """Perform undercloud and charm setup for network plumbing. :param limit_gws: Limit the number of gateways that get a port attached :type limit_gws: int """ - cli_utils.setup_logging() - # Get network configuration settings network_config = {} - # Declared overcloud settings - network_config.update(OVERCLOUD_NETWORK_CONFIG) # Default undercloud settings network_config.update(DEFAULT_UNDERCLOUD_NETWORK_CONFIG) # Environment specific settings network_config.update(generic_utils.get_undercloud_env_vars()) - # Get keystone session - keystone_session = openstack_utils.get_overcloud_keystone_session() - # Get optional use_juju_wait for network option options = (lifecycle_utils .get_charm_config(fatal=False) @@ -120,6 +110,33 @@ def basic_overcloud_network(limit_gws=None): ' charm network configuration.' .format(provider_type)) + +def basic_overcloud_network(limit_gws=None): + """Run setup for neutron networking. + + Configure the following: + The overcloud network using subnet pools + + :param limit_gws: Limit the number of gateways that get a port attached + :type limit_gws: int + """ + cli_utils.setup_logging() + + # Get network configuration settings + network_config = {} + # Declared overcloud settings + network_config.update(OVERCLOUD_NETWORK_CONFIG) + # Default undercloud settings + network_config.update(DEFAULT_UNDERCLOUD_NETWORK_CONFIG) + # Environment specific settings + network_config.update(generic_utils.get_undercloud_env_vars()) + + # Get keystone session + keystone_session = openstack_utils.get_overcloud_keystone_session() + + # Perform undercloud and charm setup for network plumbing + undercloud_and_charm_setup(limit_gws=limit_gws) + # Configure the overcloud network network.setup_sdn(network_config, keystone_session=keystone_session) diff --git a/zaza/openstack/configure/network.py b/zaza/openstack/configure/network.py index 7e4e6f0..cef23f9 100755 --- a/zaza/openstack/configure/network.py +++ b/zaza/openstack/configure/network.py @@ -87,6 +87,7 @@ from zaza.openstack.utilities import ( generic as generic_utils, openstack as openstack_utils, ) +import zaza.openstack.utilities.exceptions import zaza.utilities.juju as juju_utils @@ -276,14 +277,19 @@ def setup_gateway_ext_port(network_config, keystone_session=None, else: net_id = None - # If we're using netplan, we need to add the new interface to the guest - current_release = openstack_utils.get_os_release() - bionic_queens = openstack_utils.get_os_release('bionic_queens') - if current_release >= bionic_queens: - logging.warn("Adding second interface for dataport to guest netplan " - "for bionic-queens and later") - add_dataport_to_netplan = True - else: + try: + # If we're using netplan, we need to add the new interface to the guest + current_release = openstack_utils.get_os_release() + bionic_queens = openstack_utils.get_os_release('bionic_queens') + if current_release >= bionic_queens: + logging.warn("Adding second interface for dataport to guest " + "netplan for bionic-queens and later") + add_dataport_to_netplan = True + else: + add_dataport_to_netplan = False + except zaza.openstack.utilities.exceptions.ApplicationNotFound: + # The setup_gateway_ext_port helper may be used with non-OpenStack + # workloads. add_dataport_to_netplan = False logging.info("Configuring network for OpenStack undercloud/provider")