Add multi-region configuration in gate_hook.sh

1. What is the problem
Currently the function test job in Tricircle can only
work in single region, and most of multi-region test cases
are not able to be tested without multi-region test
environment.

2. What is the solution for the problem
Add multi-node gate job, and configure the subnode to the second
region, and use the keystone in the primary node, so that
multi-region gate/check test environment could be established
for Tricircle

3. What the features need to be implemented to the Tricircle to
realize the solution
No feature delivered to end user, just enable multi-region test.

Change-Id: I9f3d50b4fcf7796f39d3342d9a044d359f4fd7e9
Signed-off-by: joehuang <joehuang@huawei.com>
This commit is contained in:
joehuang 2017-02-27 04:06:36 -05:00
parent 6eb93e844d
commit 70fa2477ef
2 changed files with 90 additions and 8 deletions

View File

@ -0,0 +1,67 @@
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This script is executed inside gate_hook function in devstack gate.
set -ex
GATE_DEST=$BASE/new
# _setup_tricircle_multinode() - Set up two regions test environment
# in devstack multinode job. Tricircle API, central Neutron and RegionOne
# services will be enabled in primary node, RegionTwo servies will be
# enabled in the subnode. Currently only two nodes are supported in the
# test environment.
function _setup_tricircle_multinode {
PRIMARY_NODE_IP=$(cat /etc/nodepool/primary_node_private)
SUBNODE_IP=$(head -n1 /etc/nodepool/sub_nodes_private)
export OVERRIDE_ENABLED_SERVICES="c-api,c-bak,c-sch,c-vol,cinder,"
export OVERRIDE_ENABLED_SERVICES+="g-api,g-reg,horizon,key,"
export OVERRIDE_ENABLED_SERVICES+="n-api,n-cauth,n-cond,n-cpu,n-crt,"
export OVERRIDE_ENABLED_SERVICES+="n-novnc,n-obj,n-sch,"
export OVERRIDE_ENABLED_SERVICES+="placement-api,placement-client,"
export OVERRIDE_ENABLED_SERVICES+="q-agt,q-dhcp,q-l3,q-meta,"
export OVERRIDE_ENABLED_SERVICES+="q-metering,q-svc,"
export OVERRIDE_ENABLED_SERVICES+="dstat,peakmem_tracker,rabbit,mysql"
ENABLE_TRICIRCLE="enable_plugin tricircle https://git.openstack.org/openstack/tricircle/"
export DEVSTACK_LOCAL_CONFIG="$ENABLE_TRICIRCLE"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"TRICIRCLE_START_SERVICES=True"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"REGION_NAME=RegionOne"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"HOST_IP=$PRIMARY_NODE_IP"
export DEVSTACK_SUBNODE_CONFIG="$ENABLE_TRICIRCLE"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"TRICIRCLE_START_SERVICES=False"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"REGION_NAME=RegionTwo"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"HOST_IP=$SUBNODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"KEYSTONE_REGION_NAME=RegionOne"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"KEYSTONE_SERVICE_HOST=$PRIMARY_NODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"KEYSTONE_AUTH_HOST=$PRIMARY_NODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"SERVICE_HOST=$SUBNODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"RABBIT_HOST=$SUBNODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"QPID_HOST=$SUBNODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"DATABASE_HOST=$SUBNODE_IP"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"GLANCE_HOSTPORT=$SUBNODE_IP:9292"
export DEVSTACK_SUBNODE_CONFIG+=$'\n'"Q_HOST=$SUBNODE_IP"
}
if [ "$DEVSTACK_GATE_TOPOLOGY" == "multinode" ]; then
_setup_tricircle_multinode
$GATE_DEST/devstack-gate/devstack-vm-gate.sh
fi

View File

@ -22,20 +22,35 @@ export TRICIRCLE_TEMPEST_PLUGIN_DIR=$TRICIRCLE_DIR/tricircle/tempestplugin
export TEMPEST_DIR=$DEST/tempest
export TEMPEST_CONF=$TEMPEST_DIR/etc/tempest.conf
# execute test only in the primary node(i.e, RegionOne)
if [ "$OS_REGION_NAME" -ne "RegionOne" ]; then
return 0
fi
PRIMARY_NODE_IP=$(cat /etc/nodepool/primary_node_private)
# use admin role to create Tricircle top Pod and Pod1
source $DEVSTACK_DIR/openrc admin admin
unset OS_REGION_NAME
token=$(openstack token issue | awk 'NR==5 {print $4}')
echo $token
mytoken=$(openstack --os-region-name=RegionOne token issue | awk 'NR==5 {print $4}')
echo $mytoken
curl -X POST http://127.0.0.1/tricircle/v1.0/pods \
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $token" -d '{"pod": {"region_name": "RegionOne"}}'
-H "X-Auth-Token: $mytoken" -d '{"pod": {"region_name": "CentralRegion"}}'
curl -X POST http://127.0.0.1/tricircle/v1.0/pods \
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $token" \
-d '{"pod": {"region_name": "Pod1", "az_name": "az1"}}'
-H "X-Auth-Token: $mytoken" \
-d '{"pod": {"region_name": "RegionOne", "az_name": "az1"}}'
if [ "$DEVSTACK_GATE_TOPOLOGY" == "multinode" ]; then
curl -X POST http://$PRIMARY_NODE_IP/tricircle/v1.0/pods \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $mytoken" \
-d '{"pod": {"region_name": "RegionTwo", "az_name": "az2"}}'
fi
# the usage of "nova flavor-create":
# nova flavor-create [--ephemeral <ephemeral>] [--swap <swap>]
@ -44,7 +59,7 @@ curl -X POST http://127.0.0.1/tricircle/v1.0/pods \
# the following command is to create a flavor with name='test',
# id=1, ram=1024MB, disk=10GB, vcpu=1
# nova flavor-create test 1 1024 10 1
image_id=$(openstack image list | awk 'NR==4 {print $2}')
image_id=$(openstack --os-region-name=RegionOne image list | awk 'NR==4 {print $2}')
# preparation for the tests
cd $TEMPEST_DIR