Merge "Allow usage of duplicated IPs for undercloud config" into stable/train

This commit is contained in:
Zuul 2020-08-26 22:37:23 +00:00 committed by Gerrit Code Review
commit b21d2248a5
2 changed files with 5 additions and 15 deletions

View File

@ -319,18 +319,14 @@ class TestNetworkSettings(TestBaseNetworkSettings):
undercloud_admin_host='192.168.24.3', undercloud_admin_host='192.168.24.3',
undercloud_public_host='192.168.24.1', undercloud_public_host='192.168.24.1',
generate_service_certificate=True) generate_service_certificate=True)
self.assertRaises(exceptions.InvalidConfiguration, undercloud_config._process_network_args(env)
undercloud_config._process_network_args,
env)
# undercloud_admin_host == undercloud_public_host # undercloud_admin_host == undercloud_public_host
self.conf.config(local_ip='192.168.24.1/24', self.conf.config(local_ip='192.168.24.1/24',
undercloud_admin_host='192.168.24.2', undercloud_admin_host='192.168.24.2',
undercloud_public_host='192.168.24.2', undercloud_public_host='192.168.24.2',
generate_service_certificate=True) generate_service_certificate=True)
self.assertRaises(exceptions.InvalidConfiguration, undercloud_config._process_network_args(env)
undercloud_config._process_network_args,
env)
# We do not care about ip duplication when ssl is disabled # We do not care about ip duplication when ssl is disabled
self.conf.config(local_ip='192.168.24.1/24', self.conf.config(local_ip='192.168.24.1/24',

View File

@ -395,15 +395,9 @@ def _process_network_args(env):
# value here. # value here.
if (CONF.get('generate_service_certificate') or if (CONF.get('generate_service_certificate') or
CONF.get('undercloud_service_certificate')): CONF.get('undercloud_service_certificate')):
undercloud_ips = [ if CONF.local_ip.split('/')[0] == CONF.undercloud_admin_host:
CONF.local_ip.split('/')[0], msg = ("Different IPs should be assigned to local_ip and "
CONF.undercloud_admin_host, "undercloud_admin_host")
CONF.undercloud_public_host
]
if len(undercloud_ips) != len(set(undercloud_ips)):
msg = ("The same IP is used for multiple endpoints. Please use "
"unique ips for local_ip, undercloud_admin_host and "
"undercloud_public_host")
raise exceptions.InvalidConfiguration(msg) raise exceptions.InvalidConfiguration(msg)