Merge "extract setup_multinode_connectivity"
This commit is contained in:
@@ -60,6 +60,64 @@ function setup_ssh {
|
||||
-a "src=/etc/nodepool/id_rsa dest='$path/id_rsa' mode=0400"
|
||||
}
|
||||
|
||||
function setup_multinode_connectivity {
|
||||
set -x # for now enabling debug and do not turn it off
|
||||
setup_localrc "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
|
||||
# TODO (clarkb): figure out how to make bridge setup sane with ansible.
|
||||
ovs_gre_bridge "br_pub" $PRIMARY_NODE "True" 1 \
|
||||
$FLOATING_HOST_PREFIX $FLOATING_HOST_MASK \
|
||||
$SUB_NODES
|
||||
ovs_gre_bridge "br_flat" $PRIMARY_NODE "False" 128 \
|
||||
$SUB_NODES
|
||||
cat <<EOF >>"$BASE/new/devstack/sub_localrc"
|
||||
FLAT_INTERFACE=br_flat
|
||||
PUBLIC_INTERFACE=br_pub
|
||||
MULTI_HOST=True
|
||||
EOF
|
||||
cat <<EOF >>"$BASE/new/devstack/localrc"
|
||||
FLAT_INTERFACE=br_flat
|
||||
PUBLIC_INTERFACE=br_pub
|
||||
MULTI_HOST=True
|
||||
EOF
|
||||
elif [[ "$DEVSTACK_GATE_NEUTRON_DVR" -eq '1' ]]; then
|
||||
ovs_gre_bridge "br-ex" $PRIMARY_NODE "True" 1 \
|
||||
$FLOATING_HOST_PREFIX $FLOATING_HOST_MASK \
|
||||
$SUB_NODES
|
||||
fi
|
||||
|
||||
echo "Preparing cross node connectivity"
|
||||
setup_ssh $BASE/new/.ssh
|
||||
setup_ssh ~root/.ssh
|
||||
# TODO (clarkb) ansiblify the /etc/hosts and known_hosts changes
|
||||
# set up ssh_known_hosts by IP and /etc/hosts
|
||||
for NODE in $SUB_NODES; do
|
||||
ssh-keyscan $NODE >> /tmp/tmp_ssh_known_hosts
|
||||
echo $NODE `remote_command $NODE hostname | tr -d '\r'` >> /tmp/tmp_hosts
|
||||
done
|
||||
ssh-keyscan `cat /etc/nodepool/primary_node_private` >> /tmp/tmp_ssh_known_hosts
|
||||
echo `cat /etc/nodepool/primary_node_private` `hostname` >> /tmp/tmp_hosts
|
||||
cat /tmp/tmp_hosts | sudo tee --append /etc/hosts
|
||||
|
||||
# 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
|
||||
$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
|
||||
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
|
||||
done
|
||||
}
|
||||
|
||||
function setup_localrc {
|
||||
local localrc_oldnew=$1;
|
||||
local localrc_file=$2
|
||||
@@ -500,63 +558,8 @@ else
|
||||
setup_localrc "new" "localrc" "primary"
|
||||
|
||||
if [[ "$DEVSTACK_GATE_TOPOLOGY" != "aio" ]]; then
|
||||
set -x # for now enabling debug and do not turn it off
|
||||
echo -e "[[post-config|\$NOVA_CONF]]\n[libvirt]\ncpu_mode=custom\ncpu_model=gate64" >> local.conf
|
||||
setup_localrc "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
|
||||
# TODO (clarkb): figure out how to make bridge setup sane with ansible.
|
||||
ovs_gre_bridge "br_pub" $PRIMARY_NODE "True" 1 \
|
||||
$FLOATING_HOST_PREFIX $FLOATING_HOST_MASK \
|
||||
$SUB_NODES
|
||||
ovs_gre_bridge "br_flat" $PRIMARY_NODE "False" 128 \
|
||||
$SUB_NODES
|
||||
cat <<EOF >>"$BASE/new/devstack/sub_localrc"
|
||||
FLAT_INTERFACE=br_flat
|
||||
PUBLIC_INTERFACE=br_pub
|
||||
MULTI_HOST=True
|
||||
EOF
|
||||
cat <<EOF >>"$BASE/new/devstack/localrc"
|
||||
FLAT_INTERFACE=br_flat
|
||||
PUBLIC_INTERFACE=br_pub
|
||||
MULTI_HOST=True
|
||||
EOF
|
||||
elif [[ "$DEVSTACK_GATE_NEUTRON_DVR" -eq '1' ]]; then
|
||||
ovs_gre_bridge "br-ex" $PRIMARY_NODE "True" 1 \
|
||||
$FLOATING_HOST_PREFIX $FLOATING_HOST_MASK \
|
||||
$SUB_NODES
|
||||
fi
|
||||
|
||||
echo "Preparing cross node connectivity"
|
||||
setup_ssh $BASE/new/.ssh
|
||||
setup_ssh ~root/.ssh
|
||||
# TODO (clarkb) ansiblify the /etc/hosts and known_hosts changes
|
||||
# set up ssh_known_hosts by IP and /etc/hosts
|
||||
for NODE in $SUB_NODES; do
|
||||
ssh-keyscan $NODE >> /tmp/tmp_ssh_known_hosts
|
||||
echo $NODE `remote_command $NODE hostname | tr -d '\r'` >> /tmp/tmp_hosts
|
||||
done
|
||||
ssh-keyscan `cat /etc/nodepool/primary_node_private` >> /tmp/tmp_ssh_known_hosts
|
||||
echo `cat /etc/nodepool/primary_node_private` `hostname` >> /tmp/tmp_hosts
|
||||
cat /tmp/tmp_hosts | sudo tee --append /etc/hosts
|
||||
|
||||
# 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
|
||||
$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
|
||||
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
|
||||
done
|
||||
|
||||
setup_multinode_connectivity
|
||||
fi
|
||||
# Make the workspace owned by the stack user
|
||||
# It is not clear if the ansible file module can do this for us
|
||||
|
||||
Reference in New Issue
Block a user