From 59dfea0e584c9add017cb74edd548dce51c5973f Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sun, 30 Jul 2017 02:20:21 -0500 Subject: [PATCH] Ceph: Fix Multinode Gates This PS should make the multinode gate more reliable for ceph. It's not perfect in that is uses the default route IPs in zuul, which has a performance hit. The bash is also ugly as sin - but it gets us moving again until somone has time to implement a more eligant solution that works both in infra supplied nodes and other CI systems. Change-Id: Ie1326f048c43d04a945ca155bde8824d17ddcbec --- tools/gate/basic_launch.sh | 6 +++++- tools/gate/funcs/network.sh | 26 ++++++++++++++++++++++++++ tools/gate/setup_gate_worker_nodes.sh | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/tools/gate/basic_launch.sh b/tools/gate/basic_launch.sh index fe6f60ecb1..7161237d42 100755 --- a/tools/gate/basic_launch.sh +++ b/tools/gate/basic_launch.sh @@ -44,7 +44,11 @@ nameserver ${UPSTREAM_DNS} search cluster.local svc.cluster.local EOF" - SUBNET_RANGE=$(find_subnet_range) + if [ "x$INTEGRATION" == "xmulti" ]; then + SUBNET_RANGE="$(find_multi_subnet_range)" + else + SUBNET_RANGE=$(find_subnet_range) + fi export osd_cluster_network=${SUBNET_RANGE} export osd_public_network=${SUBNET_RANGE} diff --git a/tools/gate/funcs/network.sh b/tools/gate/funcs/network.sh index 54bb26cce2..85dbecfcd3 100755 --- a/tools/gate/funcs/network.sh +++ b/tools/gate/funcs/network.sh @@ -54,3 +54,29 @@ function find_subnet_range { echo "$NETWORK/$PREFIX" fi } + +function find_multi_subnet_range { + : ${PRIMARY_NODE_IP:="$(cat /etc/nodepool/primary_node | tail -1)"} + : ${SUB_NODE_IPS:="$(cat /etc/nodepool/sub_nodes)"} + NODE_IPS="${PRIMARY_NODE_IP} ${SUB_NODE_IPS}" + NODE_IP_UNSORTED=$(mktemp --suffix=.txt) + for NODE_IP in $NODE_IPS; do + echo $NODE_IP >> ${NODE_IP_UNSORTED} + done + NODE_IP_SORTED=$(mktemp --suffix=.txt) + sort -V ${NODE_IP_UNSORTED} > ${NODE_IP_SORTED} + rm -f ${NODE_IP_UNSORTED} + FIRST_IP_SUBNET=$(ipcalc "$(head -n 1 ${NODE_IP_SORTED})/24" | awk '/^Network/ { print $2 }') + LAST_IP_SUBNET=$(ipcalc "$(tail -n 1 ${NODE_IP_SORTED})/24" | awk '/^Network/ { print $2 }') + rm -f ${NODE_IP_SORTED} + function ip_diff { + echo $(($(echo $LAST_IP_SUBNET | awk -F '.' "{ print \$$1}") - $(echo $FIRST_IP_SUBNET | awk -F '.' "{ print \$$1}"))) + } + for X in {1..4}; do + if ! [ "$(ip_diff $X)" -eq "0" ]; then + SUBMASK=$(((($X - 1 )) * 8)) + break + fi + done + echo ${FIRST_IP_SUBNET%/*}/${SUBMASK} +} diff --git a/tools/gate/setup_gate_worker_nodes.sh b/tools/gate/setup_gate_worker_nodes.sh index c332c40c5e..a8976c6109 100755 --- a/tools/gate/setup_gate_worker_nodes.sh +++ b/tools/gate/setup_gate_worker_nodes.sh @@ -14,8 +14,8 @@ set -ex : ${SSH_PRIVATE_KEY:="/etc/nodepool/id_rsa"} -: ${PRIMARY_NODE_IP:="$(cat /etc/nodepool/primary_node_private | tail -1)"} -: ${SUB_NODE_IPS:="$(cat /etc/nodepool/sub_nodes_private)"} +: ${PRIMARY_NODE_IP:="$(cat /etc/nodepool/primary_node | tail -1)"} +: ${SUB_NODE_IPS:="$(cat /etc/nodepool/sub_nodes)"} export SUB_NODE_COUNT="$(($(echo ${SUB_NODE_IPS} | wc -w) + 1))" sudo chown $(whoami) ${SSH_PRIVATE_KEY}