Script to deploy stateless Tricircle

Deploy stateless Tricircle in one node using DevStack. Script
starts an extra Neutron server for bottom region, and updates
Keystone endpoint to move original Nova service to bottom region
as well as to register Tricircle Nova gateway as compute service
in top region.

This patch also updates readme file to introduce stateless
Tricircle depolyment.

Change-Id: I5c63d96bf2f7c93cc8ff56388f805425347bd8ea
This commit is contained in:
zhiyuan_cai 2015-12-25 11:51:12 +08:00
parent 3d0efc4677
commit 2eb70ab74d
4 changed files with 134 additions and 14 deletions

View File

@ -1,9 +1,85 @@
# Tricircle
(For PoC source code, please switch to ["poc"](https://github.com/openstack/tricircle/tree/poc) tag, or ["stable/fortest"](https://github.com/openstack/tricircle/tree/stable/fortest) branch)
(Attention Please, Stateless Design Proposal is being worked on the
["experiment"](https://github.com/openstack/tricircle/tree/experiment) branch).
Tricircle is a openstack project that aims to deal with OpenStack deployment across multiple sites. It provides users a single management view by having only one OpenStack instance on behalf of all the involved ones. It essentially serves as a communication bus between the central OpenStack instance and the other OpenStack instances that are called upon.
(The original PoC source code, please switch to
["poc"](https://github.com/openstack/tricircle/tree/poc) tag, or
["stable/fortest"](https://github.com/openstack/tricircle/tree/stable/fortest)
branch)
Tricircle is a OpenStack project that aims to deal with OpenStack deployment
across multiple sites. It provides users a single management view by having
only one OpenStack instance on behalf of all the involved ones. It essentially
serves as a communication bus between the central OpenStack instance and the
other OpenStack instances that are called upon.
## Project Resources
- Project status, bugs, and blueprints are tracked on [Launchpad](https://launchpad.net/tricircle)
- Additional resources are linked from the project [Wiki](https://wiki.openstack.org/wiki/Tricircle) page
- Project status, bugs, and blueprints are tracked on
[Launchpad](https://launchpad.net/tricircle)
- Additional resources are linked from the project
[Wiki](https://wiki.openstack.org/wiki/Tricircle) page
## Play with DevStack
Now stateless design can be played with DevStack.
- 1 Git clone DevStack.
- 2 Git clone Tricircle, or just download devstack/local.conf.sample
- 3 Copy devstack/local.conf.sample to DevStack folder and rename it to
local.conf, change password in the file if needed.
- 4 Run DevStack.
- 5 After DevStack successfully starts, check if services have been correctly
registered. Run "openstack endpoint list" and you should get similar output
as following:
```
+----------------------------------+-----------+--------------+----------------+
| ID | Region | Service Name | Service Type |
+----------------------------------+-----------+--------------+----------------+
| 230059e8533e4d389e034fd68257034b | RegionOne | glance | image |
| 25180a0a08cb41f69de52a7773452b28 | RegionOne | nova | compute |
| bd1ed1d6f0cc42398688a77bcc3bda91 | Pod1 | neutron | network |
| 673736f54ec147b79e97c395afe832f9 | RegionOne | ec2 | ec2 |
| fd7f188e2ba04ebd856d582828cdc50c | RegionOne | neutron | network |
| ffb56fd8b24a4a27bf6a707a7f78157f | RegionOne | keystone | identity |
| 88da40693bfa43b9b02e1478b1fa0bc6 | Pod1 | nova | compute |
| f35d64c2ddc44c16a4f9dfcd76e23d9f | RegionOne | nova_legacy | compute_legacy |
| 8759b2941fe7469e9651de3f6a123998 | RegionOne | tricircle | Cascading |
+----------------------------------+-----------+--------------+----------------+
```
"RegionOne" is the region you set in local.conf via REGION_NAME, whose default
value is "RegionOne", we use it as the top OpenStack; "Pod1" is the region set
via "POD_REGION_NAME", new configuration option introduced by Tricircle,
we use it as the bottom OpenStack.
- 6 Create site instances for both top and bottom OpenStack
```
curl -X POST http://127.0.0.1:19999/v1.0/sites -H "Content-Type: application/json" \
-H "X-Auth-Token: $token" -d '{"name": "RegionOne", "top": "True"}'
curl -X POST http://127.0.0.1:19999/v1.0/sites -H "Content-Type: application/json" \
-H "X-Auth-Token: $token" -d '{"name": "Pod1"}'
```
Pay attention to "name" parameter we specify when creating site. Site name
should exactly match the region name registered in Keystone since it is used
by Tricircle to route API request. In the above commands, we create sites named
"RegionOne" and "Pod1" for top OpenStack and bottom OpenStack. Tricircle API
service will automatically create a aggregate when user creates a bottom site,
so command "nova aggregate-list" will show the following result:
```
+----+----------+-------------------+
| Id | Name | Availability Zone |
+----+----------+-------------------+
| 1 | ag_Pod1 | az_Pod1 |
+----+----------+-------------------+
```
- 7 Create necessary resources to boot a virtual machine.
```
nova flavor-create test 1 1024 10 1
neutron net-create net1
neutron subnet-create net1 10.0.0.0/24
```
Note that flavor mapping has not been implemented yet so the created flavor is
just a database record and actually flavor in bottom OpenStack with the same id
will be used.
- 8 Boot a virtual machine.
```
nova boot --flavor 1 --image $image_id --nic net-id=$net_id --availability-zone az_Pod1 vm1
```

View File

@ -39,14 +39,19 @@ enable_service t-job
# Use Neutron instead of nova-network
disable_service n-net
disable_service n-cpu
disable_service n-sch
enable_service q-svc
disable_service q-dhcp
enable_service q-svc1
enable_service q-dhcp
enable_service q-agt
disable_service n-obj
disable_service n-cauth
disable_service n-novnc
disable_service q-l3
disable_service q-agt
disable_service c-api
disable_service c-vol
disable_service c-bak
disable_service c-sch
disable_service cinder
disable_service tempest
disable_service horizon

View File

@ -21,7 +21,7 @@ function create_tricircle_accounts {
local tricircle_api=$(get_or_create_service "tricircle" \
"Cascading" "OpenStack Cascading Service")
get_or_create_endpoint $tricircle_api \
"$TRICIRCLE_REGION_NAME" \
"$REGION_NAME" \
"$SERVICE_PROTOCOL://$TRICIRCLE_API_HOST:$TRICIRCLE_API_PORT/v1.0" \
"$SERVICE_PROTOCOL://$TRICIRCLE_API_HOST:$TRICIRCLE_API_PORT/v1.0" \
"$SERVICE_PROTOCOL://$TRICIRCLE_API_HOST:$TRICIRCLE_API_PORT/v1.0"
@ -43,8 +43,23 @@ function create_nova_apigw_accounts {
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
local tricircle_nova_apigw=$(get_or_create_service "nova" \
"compute" "Nova Compute Service")
local endpoint_id
interface_list="public admin internal"
for interface in $interface_list; do
endpoint_id=$(openstack endpoint list \
--service "$tricircle_nova_apigw" \
--interface "$interface" \
--region "$REGION_NAME" \
-c ID -f value)
if [[ -n "$endpoint_id" ]]; then
# Delete endpoint
openstack endpoint delete "$endpoint_id"
fi
done
get_or_create_endpoint $tricircle_nova_apigw \
"$TRICIRCLE_REGION_NAME" \
"$REGION_NAME" \
"$SERVICE_PROTOCOL://$TRICIRCLE_NOVA_APIGW_HOST:$TRICIRCLE_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \
"$SERVICE_PROTOCOL://$TRICIRCLE_NOVA_APIGW_HOST:$TRICIRCLE_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \
"$SERVICE_PROTOCOL://$TRICIRCLE_NOVA_APIGW_HOST:$TRICIRCLE_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s'
@ -67,7 +82,7 @@ function create_cinder_apigw_accounts {
local tricircle_cinder_apigw=$(get_or_create_service "cinder" \
"volume" "Cinder Volume Service")
get_or_create_endpoint $tricircle_cinder_apigw \
"$TRICIRCLE_REGION_NAME" \
"$REGION_NAME" \
"$SERVICE_PROTOCOL://$TRICIRCLE_CINDER_APIGW_HOST:$TRICIRCLE_CINDER_APIGW_PORT/v2/" \
"$SERVICE_PROTOCOL://$TRICIRCLE_CINDER_APIGW_HOST:$TRICIRCLE_CINDER_APIGW_PORT/v2/" \
"$SERVICE_PROTOCOL://$TRICIRCLE_CINDER_APIGW_HOST:$TRICIRCLE_CINDER_APIGW_PORT/v2/"
@ -248,8 +263,7 @@ if [[ "$Q_ENABLE_TRICIRCLE" == "True" ]]; then
python "$TRICIRCLE_DIR/cmd/manage.py" "$TRICIRCLE_API_CONF"
if is_service_enabled q-svc ; then
start_new_neutron_server 1 Site1 20001
start_new_neutron_server 2 Site2 20002
start_new_neutron_server 1 $POD_REGION_NAME $TRICIRCLE_NEUTRON_PORT
# reconfigure neutron server to use our own plugin
echo "Configuring Neutron plugin for Tricircle"
@ -280,6 +294,26 @@ if [[ "$Q_ENABLE_TRICIRCLE" == "True" ]]; then
create_nova_apigw_accounts
run_process t-ngw "python $TRICIRCLE_NOVA_APIGW --config-file $TRICIRCLE_NOVA_APIGW_CONF"
# Nova services are running, but we need to re-configure them to
# move them to bottom region
iniset $NOVA_CONF neutron region_name $POD_REGION_NAME
iniset $NOVA_CONF neutron url "$Q_PROTOCOL://$SERVICE_HOST:$TRICIRCLE_NEUTRON_PORT"
get_or_create_endpoint "compute" \
"$POD_REGION_NAME" \
"$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \
"$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \
"$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s'
stop_process n-api
stop_process n-cpu
# remove previous failure flag file since we are going to restart service
rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-api.failure
rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-cpu.failure
sleep 20
run_process n-api "$NOVA_BIN_DIR/nova-api"
run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF" $LIBVIRT_GROUP
fi
if is_service_enabled t-cgw; then
@ -312,5 +346,9 @@ if [[ "$Q_ENABLE_TRICIRCLE" == "True" ]]; then
if is_service_enabled t-job; then
stop_process t-job
fi
if is_service_enabled q-svc1; then
stop_process q-svc1
fi
fi
fi

View File

@ -4,7 +4,8 @@ TRICIRCLE_DIR=$DEST/tricircle
TRICIRCLE_BRANCH=${TRICIRCLE_BRANCH:-experiment}
# common variables
TRICIRCLE_REGION_NAME=${TRICIRCLE_REGION_NAME:-TopRegion}
POD_REGION_NAME=${POD_REGION_NAME:-Pod1}
TRICIRCLE_NEUTRON_PORT=${TRICIRCLE_NEUTRON_PORT:-20001}
TRICIRCLE_CONF_DIR=${TRICIRCLE_CONF_DIR:-/etc/tricircle}
TRICIRCLE_STATE_PATH=${TRICIRCLE_STATE_PATH:-/var/lib/tricircle}