From 952f91f00428264567baab731b4aa377e97705bc Mon Sep 17 00:00:00 2001 From: Rick Box Date: Fri, 3 Feb 2017 14:10:39 +0000 Subject: [PATCH] Adds in network config - removes hardcoded values 172.29 has the potential to conflict with internal addressing schemes. Rather than have this hard coded these changes are to allow this to be configured. Variables file has also been added to allow customization of defined values. Change-Id: I0b3e68443e7331b02794c3a54478e131d23fd5ec --- multi-node-aio/build.sh | 7 +++++++ multi-node-aio/deploy-osa.sh | 13 ++++++++++--- multi-node-aio/deploy-vms.sh | 3 +-- multi-node-aio/functions.rc | 10 +++++----- multi-node-aio/openstack-service-setup.sh | 13 ++++++++++--- multi-node-aio/setup-host.sh | 4 ++++ .../templates/kvm-bonded-bridges.cfg | 4 ++-- .../vm.openstackci.local-bonded-bridges.cfg | 8 ++++---- .../templates/openstack_user_config.yml | 18 +++++++++--------- multi-node-aio/variables.sh | 2 ++ 10 files changed, 54 insertions(+), 28 deletions(-) create mode 100755 multi-node-aio/variables.sh diff --git a/multi-node-aio/build.sh b/multi-node-aio/build.sh index b4ad4ad0..5882aace 100755 --- a/multi-node-aio/build.sh +++ b/multi-node-aio/build.sh @@ -17,6 +17,13 @@ set -eu # Load all functions source functions.rc +# bring in variable definitions if there is a variables.sh file +[[ -f variables.sh ]] && source variables.sh + +# Provide defaults for unset variables +# Set first two octets of network used for containers, storage, etc +NETWORK_BASE=${NETWORK_BASE:-172.29} + # Instruct the system do all of the require host setup SETUP_HOST=${SETUP_HOST:-true} [[ "${SETUP_HOST}" = true ]] && source setup-host.sh diff --git a/multi-node-aio/deploy-osa.sh b/multi-node-aio/deploy-osa.sh index 70e48432..a07a0a0a 100755 --- a/multi-node-aio/deploy-osa.sh +++ b/multi-node-aio/deploy-osa.sh @@ -18,6 +18,13 @@ MAX_RETRIES=${MAX_RETRIES:-5} # Load all functions source functions.rc +# bring in variable definitions if there is a variables.sh file +[[ -f variables.sh ]] && source variables.sh + +# Provide defaults for unset variables +# Set first two octets of network used for containers, storage, etc +NETWORK_BASE=${NETWORK_BASE:-172.29} + # Reset the ssh-agent service to remove potential key issues ssh_agent_reset @@ -46,7 +53,7 @@ ansible_static_inventory "/opt/ansible-static-inventory.ini" # Create the OpenStack User Config HOSTIP="$(ip route get 1 | awk '{print $NF;exit}')" -sed "s/__HOSTIP__/${HOSTIP}/g" templates/openstack_user_config.yml > /etc/openstack_deploy/openstack_user_config.yml +sed -e "s/__HOSTIP__/${HOSTIP}/g" -e "s/__NETWORK_BASE__/${NETWORK_BASE}/g" templates/openstack_user_config.yml > /etc/openstack_deploy/openstack_user_config.yml # Create the swift config: function group_name host_type cp -v templates/osa-swift.yml /etc/openstack_deploy/conf.d/swift.yml @@ -91,7 +98,7 @@ if [[ "${PRE_CONFIG_OSA}" = true ]]; then osa_user_var_add lxc_container_backing_store 'lxc_container_backing_store: dir' # Tempest is being configured to use a known network - osa_user_var_add tempest_public_subnet_cidr 'tempest_public_subnet_cidr: 172.29.248.0/22' + osa_user_var_add tempest_public_subnet_cidr 'tempest_public_subnet_cidr: '${NETWORK_BASE}'.248.0/22' # This makes running neutron in a distributed system easier and a lot less noisy osa_user_var_add neutron_l2_population 'neutron_l2_population: True' @@ -117,6 +124,6 @@ if [[ "${RUN_OSA}" = true ]]; then if [[ -f "/usr/local/bin/openstack-ansible.rc" ]]; then source /usr/local/bin/openstack-ansible.rc fi - ansible -m script -a "${EXEC_DIR}/openstack-service-setup.sh" 'utility_all[0]' + ansible -m script -a "${EXEC_DIR}/openstack-service-setup.sh ${NETWORK_BASE}" 'utility_all[0]' popd fi diff --git a/multi-node-aio/deploy-vms.sh b/multi-node-aio/deploy-vms.sh index 405ee8b5..8526d524 100755 --- a/multi-node-aio/deploy-vms.sh +++ b/multi-node-aio/deploy-vms.sh @@ -37,7 +37,7 @@ done # Populate network configurations based on node type for node_type in $(get_all_types); do for node in $(get_host_type ${node_type}); do - sed "s/__COUNT__/${node#*":"}/g" "templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg" > "/var/www/html/osa-${node%%":"*}.openstackci.local-bridges.cfg" + sed -e "s/__COUNT__/${node#*":"}/g" -e "s/__NETWORK_BASE__/${NETWORK_BASE}/g" "templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg" > "/var/www/html/osa-${node%%":"*}.openstackci.local-bridges.cfg" done done @@ -74,4 +74,3 @@ for node in $(get_all_hosts); do apt-get clean; \ apt-get update" done - diff --git a/multi-node-aio/functions.rc b/multi-node-aio/functions.rc index 0eb8d989..13b94995 100755 --- a/multi-node-aio/functions.rc +++ b/multi-node-aio/functions.rc @@ -115,7 +115,7 @@ echo "---" >> ${CONFD_FILE} echo "$1:" >> ${CONFD_FILE} for node in $(get_host_type ${2}); do echo " ${node%%':'*}:" >> ${CONFD_FILE} -echo " ip: 172.29.236.${node#*":"}" >> ${CONFD_FILE} +echo " ip: ${NETWORK_BASE}.236.${node#*":"}" >> ${CONFD_FILE} done } @@ -126,7 +126,7 @@ echo "---" >> ${CONFD_FILE} echo "$1:" >> ${CONFD_FILE} for node in $(get_host_type ${2}); do echo " ${node%%':'*}:" >> ${CONFD_FILE} -echo " ip: 172.29.236.${node#*":"}" >> ${CONFD_FILE} +echo " ip: ${NETWORK_BASE}.236.${node#*":"}" >> ${CONFD_FILE} cat >> ${CONFD_FILE} <> ${CONFD_FILE} <> ${CONFD_FILE} echo "$1:" >> ${CONFD_FILE} for node in $(get_host_type ${2}); do echo " ${node%%':'*}:" >> ${CONFD_FILE} -echo " ip: 172.29.236.${node#*":"}" >> ${CONFD_FILE} +echo " ip: ${NETWORK_BASE}.236.${node#*":"}" >> ${CONFD_FILE} cat >> ${CONFD_FILE} <> ${CONFD_FILE} echo "$1:" >> ${CONFD_FILE} for node in $(get_host_type ${2}); do echo " ${node%%':'*}:" >> ${CONFD_FILE} -echo " ip: 172.29.236.${node#*":"}" >> ${CONFD_FILE} +echo " ip: ${NETWORK_BASE}.236.${node#*":"}" >> ${CONFD_FILE} cat >> ${CONFD_FILE} <