From 6789f2e9a90de492f3b6c0b9f954ec0703948208 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Wed, 24 Oct 2018 19:03:50 +0300 Subject: [PATCH] Undercloud: Disable persisting VIPs in /etc/hosts This adds the use-dns-for-vips.yaml which disables persisting the VIP hosts to /etc/hosts. This is because sometimes we might be setting the CloudName to an IP (for using IPs as keystone endpoints). Without this, we'll get an erroneous value there. Change-Id: Ie28f51d6729f5f4b940bfcc8e77968dd57d41669 Closes-Bug: #1799724 --- .../tests/v1/undercloud/test_undercloud.py | 62 +++++++++---------- tripleoclient/v1/undercloud_config.py | 7 +-- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/tripleoclient/tests/v1/undercloud/test_undercloud.py b/tripleoclient/tests/v1/undercloud/test_undercloud.py index db8b311b0..b5d5bbf33 100644 --- a/tripleoclient/tests/v1/undercloud/test_undercloud.py +++ b/tripleoclient/tests/v1/undercloud/test_undercloud.py @@ -73,7 +73,9 @@ class TestUndercloudInstall(TestPluginV1): '--templates=/usr/share/openstack-tripleo-heat-templates/', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -94,8 +96,6 @@ class TestUndercloudInstall(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -142,6 +142,7 @@ class TestUndercloudInstall(TestPluginV1): '--roles-file=foo/roles.yaml', '--heat-native=False', '-e', '/usertht/environments/undercloud.yaml', '-e', + '/usertht/environments/use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usertht/environments/services/ironic.yaml', '-e', '/usertht/environments/services/ironic-inspector.yaml', '-e', @@ -153,7 +154,6 @@ class TestUndercloudInstall(TestPluginV1): '--public-virtual-ip', '192.168.24.2', '--control-virtual-ip', '192.168.24.3', '-e', '/usertht/environments/ssl/tls-endpoints-public-ip.yaml', '-e', - '/usertht/environments/use-dns-for-vips.yaml', '-e', '/usertht/environments/services/undercloud-haproxy.yaml', '-e', '/usertht/environments/services/undercloud-keepalived.yaml', # TODO(cjeanner) drop once we have proper oslo.privsep @@ -292,7 +292,9 @@ class TestUndercloudInstall(TestPluginV1): '--templates=/usr/share/openstack-tripleo-heat-templates/', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/' 'environments/services/masquerade-networks.yaml', '-e', @@ -316,8 +318,6 @@ class TestUndercloudInstall(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -361,7 +361,9 @@ class TestUndercloudInstall(TestPluginV1): '--templates=/usr/share/openstack-tripleo-heat-templates/', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -382,8 +384,6 @@ class TestUndercloudInstall(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -423,7 +423,9 @@ class TestUndercloudInstall(TestPluginV1): '--templates=/usr/share/openstack-tripleo-heat-templates/', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -444,8 +446,6 @@ class TestUndercloudInstall(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -482,7 +482,9 @@ class TestUndercloudInstall(TestPluginV1): '--templates=/usr/share/openstack-tripleo-heat-templates/', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -507,8 +509,6 @@ class TestUndercloudInstall(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -560,7 +560,9 @@ class TestUndercloudUpgrade(TestPluginV1): 'lifecycle/undercloud-upgrade-prepare.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -581,8 +583,6 @@ class TestUndercloudUpgrade(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -622,7 +622,9 @@ class TestUndercloudUpgrade(TestPluginV1): 'lifecycle/undercloud-upgrade-prepare.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -643,8 +645,6 @@ class TestUndercloudUpgrade(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -683,7 +683,9 @@ class TestUndercloudUpgrade(TestPluginV1): 'lifecycle/undercloud-upgrade-prepare.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -704,8 +706,6 @@ class TestUndercloudUpgrade(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -744,7 +744,9 @@ class TestUndercloudUpgrade(TestPluginV1): 'lifecycle/undercloud-upgrade-prepare.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -765,8 +767,6 @@ class TestUndercloudUpgrade(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', @@ -809,7 +809,9 @@ class TestUndercloudUpgrade(TestPluginV1): 'lifecycle/undercloud-upgrade-prepare.yaml', '--heat-native', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e', + 'undercloud.yaml', '-e', + '/usr/share/openstack-tripleo-heat-templates/environments/' + 'use-dns-for-vips.yaml', '-e', '/home/stack/foo.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/ironic.yaml', '-e', @@ -830,8 +832,6 @@ class TestUndercloudUpgrade(TestPluginV1): '/usr/share/openstack-tripleo-heat-templates/environments/' 'ssl/tls-endpoints-public-ip.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' - 'use-dns-for-vips.yaml', '-e', - '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-haproxy.yaml', '-e', '/usr/share/openstack-tripleo-heat-templates/environments/' 'services/undercloud-keepalived.yaml', diff --git a/tripleoclient/v1/undercloud_config.py b/tripleoclient/v1/undercloud_config.py index cf3e6993d..62d88854b 100644 --- a/tripleoclient/v1/undercloud_config.py +++ b/tripleoclient/v1/undercloud_config.py @@ -367,7 +367,9 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False, # These should be loaded first so we can override all the bits later deploy_args += [ - "-e", os.path.join(tht_templates, "environments/undercloud.yaml")] + "-e", os.path.join(tht_templates, "environments/undercloud.yaml"), + '-e', os.path.join(tht_templates, 'environments/use-dns-for-vips.yaml') + ] # If a container images file is used, copy it into the tempdir to make it # later into other deployment artifacts and user-provided files. @@ -471,9 +473,6 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False, deploy_args += [ '-e', endpoint_environment, - '-e', os.path.join( - tht_templates, - 'environments/use-dns-for-vips.yaml'), '-e', os.path.join( tht_templates, 'environments/services/undercloud-haproxy.yaml'),