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
This commit is contained in:
Pete Birley 2017-07-30 02:20:21 -05:00
parent 04e015e49b
commit 59dfea0e58
3 changed files with 33 additions and 3 deletions

View File

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

View File

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

View File

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