Allow usage of duplicated IPs for undercloud config

Change 2600260be5 introduced validation
to avoid duplicated usage of undercloud IPs, but in fact we don't need
to ensure complete unieqness of local_ip, undercloud_admin_host and
undercloud_public_host, but it should be enough if local_ip and
undercloud_admin_host are different, because public endpoints should
listen on different ports when ssl is enabled.

This patch eases the validation introduced by the previous patch, so
that we allow the deployment especially with the same ip used for
public_host and admin_host, which was allowed in old releases.

Depends-On: https://review.opendev.org/746671
Change-Id: I932482e097d62f46e02eb035435d2bc0d5548b2a
Related-Bug: #1832168
Related: RHBZ#1868910
This commit is contained in:
Takashi Kajinami 2020-08-18 21:30:16 +09:00
parent 5e68a6d1c6
commit 5b246e4f1a
2 changed files with 5 additions and 15 deletions

View File

@ -322,18 +322,14 @@ class TestNetworkSettings(TestBaseNetworkSettings):
undercloud_admin_host='192.168.24.3',
undercloud_public_host='192.168.24.1',
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
self.conf.config(local_ip='192.168.24.1/24',
undercloud_admin_host='192.168.24.2',
undercloud_public_host='192.168.24.2',
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
self.conf.config(local_ip='192.168.24.1/24',

View File

@ -408,15 +408,9 @@ def _process_network_args(env):
# value here.
if (CONF.get('generate_service_certificate') or
CONF.get('undercloud_service_certificate')):
undercloud_ips = [
CONF.local_ip.split('/')[0],
CONF.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")
if CONF.local_ip.split('/')[0] == CONF.undercloud_admin_host:
msg = ("Different IPs should be assigned to local_ip and "
"undercloud_admin_host")
raise exceptions.InvalidConfiguration(msg)