From a9d74f134898cbeb60cfd8fec2ee6a8621e2ad9c Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Tue, 19 Aug 2014 08:54:56 +0200 Subject: [PATCH] labs: set tunnel IP address Replace placeholder INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS with the node's IP address in the data network. To that end, the patch adds a new function hostname_to_ip. Change-Id: I7baabdde50e62c9c8f006c19eddeca54d368666b Implements: blueprint openstack-training-labs --- labs/lib/functions.guest | 5 +++++ labs/scripts/setup_neutron_compute.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/labs/lib/functions.guest b/labs/lib/functions.guest index 4472f1f4..116af206 100644 --- a/labs/lib/functions.guest +++ b/labs/lib/functions.guest @@ -303,6 +303,11 @@ function get_ip_from_net_and_fourth { echo "${NET%.*}.$FOURTH_OCTET" } +function hostname_to_ip { + local host_name=$1 + getent hosts "$host_name"|awk '{print $1}' +} + function config_network { if is_ubuntu; then # Configuration functions will append to this file diff --git a/labs/scripts/setup_neutron_compute.sh b/labs/scripts/setup_neutron_compute.sh index 51c0dcf6..5d2beaa6 100755 --- a/labs/scripts/setup_neutron_compute.sh +++ b/labs/scripts/setup_neutron_compute.sh @@ -68,7 +68,7 @@ iniset_sudo $conf securitygroup firewall_driver neutron.agent.linux.iptables_fir iniset_sudo $conf securitygroup enable_security_group True # Under the ovs section -iniset_sudo $conf ovs local_ip INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS +iniset_sudo $conf ovs local_ip "$(hostname_to_ip compute-data)" iniset_sudo $conf ovs tunnel_type gre iniset_sudo $conf ovs enable_tunneling True