summaryrefslogtreecommitdiffstats
path: root/apex/undercloud/undercloud.py
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-05-23 16:51:48 -0400
committerTim Rozet <trozet@redhat.com>2018-05-30 18:58:45 +0000
commitd0f4951e914cacd99c750cb04a332cd7251b9de8 (patch)
treea4d9dc047c8be37c7c82f3f1583e613679b624ff /apex/undercloud/undercloud.py
parentf0268bd12aab93870a8f2f322f75ccf3965ca476 (diff)
Configure NAT with baremetal when necessary
We currently only enable NAT on undercloud for virtual deployments. However, there could be a case where a baremetal deployment also needs NAT as it is not using an interface on the overcloud nodes with external access. Therefore this patch changes the behavior to configure NAT when the gateway of either the external or admin (when external is disabled) network matches an IP assigned to the undercloud. JIRA: APEX-605 Change-Id: I9c79af371913e6e5f0d39b433f68205bc7e106c5 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'apex/undercloud/undercloud.py')
-rw-r--r--apex/undercloud/undercloud.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/apex/undercloud/undercloud.py b/apex/undercloud/undercloud.py
index 3cd1e70f..d2de2de1 100644
--- a/apex/undercloud/undercloud.py
+++ b/apex/undercloud/undercloud.py
@@ -124,6 +124,16 @@ class Undercloud:
"Unable to find IP for undercloud. Check if VM booted "
"correctly")
+ def detect_nat(self, net_settings):
+ if self.external_net:
+ net = net_settings['networks'][constants.EXTERNAL_NETWORK][0]
+ else:
+ net = net_settings['networks'][constants.ADMIN_NETWORK]
+ if net['gateway'] == net['installer_vm']['ip']:
+ return True
+ else:
+ return False
+
def configure(self, net_settings, deploy_settings,
playbook, apex_temp_dir, virtual_oc=False):
"""
@@ -141,7 +151,8 @@ class Undercloud:
ansible_vars = Undercloud.generate_config(net_settings,
deploy_settings)
ansible_vars['apex_temp_dir'] = apex_temp_dir
- ansible_vars['virtual_overcloud'] = virtual_oc
+
+ ansible_vars['nat'] = self.detect_nat(net_settings)
try:
utils.run_ansible(ansible_vars, playbook, host=self.ip,
user='stack')