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
This commit is contained in:
Rick Box 2017-02-03 14:10:39 +00:00
parent f8fef621cb
commit 952f91f004
10 changed files with 54 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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} <<EOF
container_vars:
cinder_backends:
@ -135,7 +135,7 @@ cat >> ${CONFD_FILE} <<EOF
volume_group: cinder-volumes
volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver
volume_backend_name: LVM_iSCSI
iscsi_ip_address: "172.29.236.${node#*":"}"
iscsi_ip_address: "${NETWORK_BASE}.236.${node#*":"}"
EOF
done
}
@ -147,7 +147,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} <<EOF
container_vars:
swift_proxy_vars:
@ -166,7 +166,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} <<EOF
container_vars:
swift_vars:

View File

@ -3,6 +3,13 @@
# Load service variables
source openrc
# 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}
# Create base flavors for the new deployment
for flavor in micro tiny mini small medium large xlarge heavy; do
NAME="m1.${flavor}"
@ -48,10 +55,10 @@ neutron net-create GATEWAY_NET \
--provider:physical_network=flat \
--provider:network_type=flat
neutron subnet-create GATEWAY_NET 172.29.248.0/22 \
neutron subnet-create GATEWAY_NET ${NETWORK_BASE}.248.0/22 \
--name GATEWAY_NET_SUBNET \
--gateway 172.29.248.1 \
--allocation-pool start=172.29.248.201,end=172.29.248.255 \
--gateway ${NETWORK_BASE}.248.1 \
--allocation-pool start=${NETWORK_BASE}.248.201,end=${NETWORK_BASE}.248.255 \
--dns-nameservers list=true 8.8.4.4 8.8.8.8
# Neutron private network setup

View File

@ -46,6 +46,10 @@ fi
# create kvm bridges
cp -v templates/kvm-bonded-bridges.cfg /etc/network/interfaces.d/kvm-bridges.cfg
# set network address
sed -i "s|__NETWORK_BASE__|${NETWORK_BASE}|g" /etc/network/interfaces.d/kvm-bridges.cfg
for i in $(awk '/iface/ {print $2}' /etc/network/interfaces.d/kvm-bridges.cfg); do
ifup $i
done

View File

@ -12,7 +12,7 @@ iface vm-br-eth1 inet static
bridge_waitport 0
bridge_fd 0
bridge_ports none
address 172.29.236.200
address __NETWORK_BASE__.236.200
netmask 255.255.252.0
offload-sg off
@ -23,7 +23,7 @@ iface vm-br-eth2 inet static
bridge_waitport 0
bridge_fd 0
bridge_ports none
address 172.29.248.1
address __NETWORK_BASE__.248.1
netmask 255.255.252.0
offload-sg off

View File

@ -25,7 +25,7 @@ iface br-mgmt inet static
bridge_waitport 10
bridge_fd 0
bridge_ports eth1
address 172.29.236.__COUNT__
address __NETWORK_BASE__.236.__COUNT__
netmask 255.255.252.0
offload-sg off
@ -35,7 +35,7 @@ iface br-flat inet static
bridge_waitport 10
bridge_fd 0
bridge_ports eth2
address 172.29.248.__COUNT__
address __NETWORK_BASE__.248.__COUNT__
netmask 255.255.252.0
offload-sg off
@ -53,7 +53,7 @@ iface br-vxlan inet static
bridge_waitport 10
bridge_fd 0
bridge_ports eth4
address 172.29.240.__COUNT__
address __NETWORK_BASE__.240.__COUNT__
netmask 255.255.252.0
offload-sg off
# To ensure ssh checksum is correct
@ -71,6 +71,6 @@ iface br-storage inet static
bridge_waitport 10
bridge_fd 0
bridge_ports eth5
address 172.29.244.__COUNT__
address __NETWORK_BASE__.244.__COUNT__
netmask 255.255.252.0
offload-sg off

View File

@ -1,17 +1,17 @@
---
cidr_networks:
container: 172.29.236.0/22
tunnel: 172.29.240.0/22
storage: 172.29.244.0/22
container: __NETWORK_BASE__.236.0/22
tunnel: __NETWORK_BASE__.240.0/22
storage: __NETWORK_BASE__.244.0/22
used_ips:
- "172.29.236.0,172.29.236.200"
- "172.29.240.0,172.29.240.200"
- "172.29.244.0,172.29.244.200"
- "172.29.248.0,172.29.248.200"
- "__NETWORK_BASE__.236.0,__NETWORK_BASE__.236.200"
- "__NETWORK_BASE__.240.0,__NETWORK_BASE__.240.200"
- "__NETWORK_BASE__.244.0,__NETWORK_BASE__.244.200"
- "__NETWORK_BASE__.248.0,__NETWORK_BASE__.248.200"
global_overrides:
internal_lb_vip_address: 172.29.236.200
internal_lb_vip_address: __NETWORK_BASE__.236.200
# The external IP is quoted simply to ensure that the .aio file can be used as input
# dynamic inventory testing.
external_lb_vip_address: "__HOSTIP__"
@ -72,4 +72,4 @@ global_overrides:
haproxy_hosts:
loadbalancer1:
ip: 172.29.236.200
ip: __NETWORK_BASE__.236.200

2
multi-node-aio/variables.sh Executable file
View File

@ -0,0 +1,2 @@
# Variables used by multi-node-aio
NETWORK_BASE=172.29