Merge "Ceph: Fix Multinode Gates"

This commit is contained in:
Jenkins 2017-08-07 16:28:17 +00:00 committed by Gerrit Code Review
commit dbfbbda826
3 changed files with 33 additions and 3 deletions

View File

@ -46,7 +46,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}