From c2a770648933e9ac1cef7eae33662aa2653ab5c4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 18 Aug 2020 21:30:16 +0900 Subject: [PATCH] Allow usage of duplicated IPs for undercloud config Change 2600260be5ad99da36775e470758591d8fcd2ca9 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/747479 Change-Id: I932482e097d62f46e02eb035435d2bc0d5548b2a Related-Bug: #1832168 Related: RHBZ#1868910 (cherry picked from commit 5b246e4f1aa86f8fe2cadb5fccf087dafa36523e) --- tripleoclient/tests/v1/undercloud/test_config.py | 8 ++------ tripleoclient/v1/undercloud_config.py | 12 +++--------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tripleoclient/tests/v1/undercloud/test_config.py b/tripleoclient/tests/v1/undercloud/test_config.py index e17b9f1ea..b06b46896 100644 --- a/tripleoclient/tests/v1/undercloud/test_config.py +++ b/tripleoclient/tests/v1/undercloud/test_config.py @@ -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', diff --git a/tripleoclient/v1/undercloud_config.py b/tripleoclient/v1/undercloud_config.py index 7938c4bc1..657bc080a 100644 --- a/tripleoclient/v1/undercloud_config.py +++ b/tripleoclient/v1/undercloud_config.py @@ -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)