Merge "grenade partial multinode support"

This commit is contained in:
Jenkins
2015-08-06 19:50:56 +00:00
committed by Gerrit Code Review

View File

@@ -61,8 +61,31 @@ function setup_ssh {
}
function setup_multinode_connectivity {
local mode=${1:-"devstack"}
# Multinode setup variables:
#
# ``localrc`` - location to write localrc content on the primary
# node. In grenade mode we write to the grenade template that is
# copied into old and new.
#
# ``old_or_new`` - should the subnodes be computed on the old side
# or new side. For grenade where we don't upgrade them, calculate
# on the old side.
local localrc=$BASE/new/devstack/localrc
local old_or_new="new"
if [[ "$mode" == "grenade" ]]; then
localrc=$BASE/new/grenade/devstack.localrc
old_or_new="old"
fi
# set explicit paths on all conf files we're writing so that
# current working directory doesn't introduce subtle bugs.
local devstack_dir=$BASE/$old_or_new/devstack
local sub_localrc=$devstack_dir/sub_localrc
local localconf=$devstack_dir/local.conf
set -x # for now enabling debug and do not turn it off
setup_localrc "new" "sub_localrc" "sub"
setup_localrc $old_or_new "$sub_localrc" "sub"
PRIMARY_NODE=`cat /etc/nodepool/primary_node_private`
SUB_NODES=`cat /etc/nodepool/sub_nodes_private`
if [[ "$DEVSTACK_GATE_NEUTRON" -ne '1' ]]; then
@@ -72,12 +95,12 @@ function setup_multinode_connectivity {
$SUB_NODES
ovs_gre_bridge "br_flat" $PRIMARY_NODE "False" 128 \
$SUB_NODES
cat <<EOF >>"$BASE/new/devstack/sub_localrc"
cat <<EOF >>"$sub_localrc"
FLAT_INTERFACE=br_flat
PUBLIC_INTERFACE=br_pub
MULTI_HOST=True
EOF
cat <<EOF >>"$BASE/new/devstack/localrc"
cat <<EOF >>"$localrc"
FLAT_INTERFACE=br_flat
PUBLIC_INTERFACE=br_pub
MULTI_HOST=True
@@ -104,17 +127,18 @@ EOF
# set up ssh_known_host files based on hostname
for HOSTNAME in `cat /tmp/tmp_hosts | cut -d' ' -f2`; do
ssh-keyscan $HOSTNAME >> /tmp/tmp_ssh_known_hosts
done
done
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \
-a "src=/tmp/tmp_ssh_known_hosts dest=/etc/ssh/ssh_known_hosts mode=0444"
for NODE in $SUB_NODES; do
remote_copy_file /tmp/tmp_hosts $NODE:/tmp/tmp_hosts
remote_command $NODE "cat /tmp/tmp_hosts | sudo tee --append /etc/hosts > /dev/null"
cp sub_localrc /tmp/tmp_sub_localrc
cp $sub_localrc /tmp/tmp_sub_localrc
echo "HOST_IP=$NODE" >> /tmp/tmp_sub_localrc
remote_copy_file /tmp/tmp_sub_localrc $NODE:$BASE/new/devstack/localrc
remote_copy_file local.conf $NODE:$BASE/new/devstack/local.conf
remote_copy_file /tmp/tmp_sub_localrc $NODE:$devstack_dir/localrc
remote_copy_file $localconf $NODE:$localconf
done
}
@@ -542,14 +566,35 @@ EOF
echo "$GRENADE_PLUGINRC" >>$BASE/new/grenade/pluginrc
fi
if [[ "$DEVSTACK_GATE_TOPOLOGY" == "multinode" ]]; then
echo -e "[[post-config|\$NOVA_CONF]]\n[libvirt]\ncpu_mode=custom\ncpu_model=gate64" >> local.conf
# this pins everything to the rpc version of the stable side
echo -e "[upgrade_levels]\ncompute=$(basename $GRENADE_OLD_BRANCH)" >> local.conf
# get this in our base config
cp local.conf $BASE/old/devstack
setup_multinode_connectivity "grenade"
# build the post-stack.sh config, this will be run as stack user so no sudo required
cat > $BASE/new/grenade/post-stack.sh <<EOF
#!/bin/bash
set -x
$ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" -m shell \
-a "cd '$BASE/old/devstack' && stdbuf -oL -eL ./stack.sh"
EOF
sudo chmod a+x $BASE/new/grenade/post-stack.sh
fi
# Make the workspace owned by the stack user
# It is not clear if the ansible file module can do this for us
$ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m shell \
-a "chown -R stack:stack '$BASE'"
cd $BASE/new/grenade
echo "Running grenade ..."
echo "This takes a good 30 minutes or more"
cd $BASE/new/grenade
sudo -H -u stack stdbuf -oL -eL ./grenade.sh
cd $BASE/new/devstack