Re-order checks in networking auto-detection
To support OVS to OVN migration checks we want the basic overcloud configure job to set up N-OVS and/or N-GW when present and the OVN pre migration configure job will copy the configuration for us.
This commit is contained in:
@@ -1227,6 +1227,13 @@ class TestOpenStackUtils(ut_utils.BaseTestCase):
|
||||
self.get_application.side_effect = [KeyError, KeyError]
|
||||
self.assertFalse(openstack_utils.ovn_present())
|
||||
|
||||
def test_ngw_present(self):
|
||||
self.patch_object(openstack_utils.model, 'get_application')
|
||||
self.get_application.side_effect = None
|
||||
self.assertTrue(openstack_utils.ngw_present())
|
||||
self.get_application.side_effect = KeyError
|
||||
self.assertFalse(openstack_utils.ngw_present())
|
||||
|
||||
def test_configure_gateway_ext_port(self):
|
||||
# FIXME: this is not a complete unit test for the function as one did
|
||||
# not exist at all I'm adding this to test one bit and we'll add more
|
||||
@@ -1234,10 +1241,12 @@ class TestOpenStackUtils(ut_utils.BaseTestCase):
|
||||
self.patch_object(openstack_utils, 'deprecated_external_networking')
|
||||
self.patch_object(openstack_utils, 'dvr_enabled')
|
||||
self.patch_object(openstack_utils, 'ovn_present')
|
||||
self.patch_object(openstack_utils, 'ngw_present')
|
||||
self.patch_object(openstack_utils, 'get_gateway_uuids')
|
||||
self.patch_object(openstack_utils, 'get_admin_net')
|
||||
self.dvr_enabled = False
|
||||
self.ovn_present = False
|
||||
self.dvr_enabled.return_value = False
|
||||
self.ovn_present.return_value = False
|
||||
self.ngw_present.return_value = True
|
||||
self.get_admin_net.return_value = {'id': 'fakeid'}
|
||||
|
||||
novaclient = mock.MagicMock()
|
||||
|
||||
@@ -554,6 +554,20 @@ def dvr_enabled():
|
||||
return get_application_config_option('neutron-api', 'enable-dvr')
|
||||
|
||||
|
||||
def ngw_present():
|
||||
"""Check whether Neutron Gateway is present in deployment.
|
||||
|
||||
:returns: True when Neutron Gateway is present, False otherwise
|
||||
:rtype: bool
|
||||
"""
|
||||
try:
|
||||
model.get_application('neutron-gateway')
|
||||
return True
|
||||
except KeyError:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def ovn_present():
|
||||
"""Check whether OVN is present in deployment.
|
||||
|
||||
@@ -721,6 +735,9 @@ def configure_gateway_ext_port(novaclient, neutronclient, net_id=None,
|
||||
except KeyError:
|
||||
# neutron-gateway not in deployment
|
||||
pass
|
||||
elif ngw_present():
|
||||
uuids = itertools.islice(get_gateway_uuids(), limit_gws)
|
||||
application_names = ['neutron-gateway']
|
||||
elif ovn_present():
|
||||
uuids = itertools.islice(get_ovn_uuids(), limit_gws)
|
||||
application_names = ['ovn-chassis']
|
||||
@@ -735,8 +752,7 @@ def configure_gateway_ext_port(novaclient, neutronclient, net_id=None,
|
||||
config.update({'ovn-bridge-mappings': 'physnet1:br-ex'})
|
||||
add_dataport_to_netplan = True
|
||||
else:
|
||||
uuids = itertools.islice(get_gateway_uuids(), limit_gws)
|
||||
application_names = ['neutron-gateway']
|
||||
raise RuntimeError('Unable to determine charm network topology.')
|
||||
|
||||
if not net_id:
|
||||
net_id = get_admin_net(neutronclient)['id']
|
||||
|
||||
Reference in New Issue
Block a user