Update devstack plugin to support multi-region installation

1.What is the problem?
Devstack plugin only supports the first region installation,
for the second region installation with Tricircle local plugin,
need to install the tricircle package manually (please refer
to the multi-pod-installation-devstack.rst in doc/source).

2.What is the solution to the problem?
If we want to support multi-region gate/check test job
(https://blueprints.launchpad.net/tricircle/+spec/multi-region-job-for-gate-and-check-test),
the second region in the gate/check job can only be installed
through devstack plugin and local.conf. So we have to improve
the devstack plugin to support the second region installation.

Tricircle AdminAPI and XJob shouldn't be started in the second
region, there is no need to generate database schema
for the second region too. only the plugin needs to be installed
and configured in local Neutron. So TRICIRCLE_START_SERVICES is
introduced in devstack local.conf. The TRICIRCLE_START_SERVICES
variable needs to be enabled in the first region and disabled
in the second one.

At the same time, remove the variable Q_ENABLE_TRICIRCLE judgement
and configuration, if the Tricircle DevStack plugin is enabled,
that means the plugin itself will run by default.

3.What the features need to be implemented to the Tricircle
  to realize the solution?
No new features.

Change-Id: Ib66a22f9e4889d131e5e481e9dec98efca5ed6fe
Signed-off-by: joehuang <joehuang@huawei.com>
This commit is contained in:
joehuang 2016-12-26 02:22:56 -05:00
parent 25a852d100
commit 8616eb5fa4
5 changed files with 169 additions and 182 deletions

View File

@ -2,16 +2,17 @@
# Sample DevStack local.conf.
#
# This sample file is intended to be used for your typical Tricircle DevStack
# multi-node environment. As this file configures, DevStack will setup two
# regions, one top region running Tricircle services, Keystone, Glance, Nova
# API gateway, Cinder API gateway and Neutron with Tricircle plugin; and one
# bottom region running original Nova, Cinder and Neutron.
# multi-node environment. This file has the configuration values for DevStack
# to result in Central Neutron service and Tricircle Admin API service
# registered in CentralRegion, and local Neutron service and remaining
# services(e. g. Nova, Cinder, etc.) will be placed in RegionOne, but Keystone
# will be registered in RegionOne and is shared by services in all the
# regions.
#
# This file works with local.conf.node_2.sample to help you build a two-node
# three-region Tricircle environment. Keystone and Glance in top region are
# shared by services in all the regions.
# three-region Tricircle environment(Central Region, RegionOne and RegionTwo).
#
# Some options needs to be change to adapt to your environment, see README.md
# Some options need to be changed to adapt to your environment, see README.rst
# for detail.
#
@ -22,61 +23,20 @@ RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
ADMIN_PASSWORD=password
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
FIXED_RANGE=10.0.0.0/24
NETWORK_GATEWAY=10.0.0.1
FIXED_NETWORK_SIZE=256
FLOATING_RANGE=10.100.100.160/24
Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192
PUBLIC_NETWORK_GATEWAY=10.100.100.3
Q_USE_SECGROUP=False
LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
NEUTRON_CREATE_INITIAL_NETWORKS=False
Q_USE_PROVIDERNET_FOR_PUBLIC=True
HOST_IP=10.250.201.24
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=(network_vlan_ranges=bridge:2001:3000)
OVS_BRIDGE_MAPPINGS=bridge:br-bridge
Q_ENABLE_TRICIRCLE=True
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=(network_vlan_ranges=bridge:2001:3000)
OVS_BRIDGE_MAPPINGS=bridge:br-vlan
# Specify Central Region name
# CENTRAL_REGION_NAME=CentralRegion
# Specify port for central Neutron server
# TRICIRCLE_NEUTRON_PORT=20001
TRICIRCLE_START_SERVICES=True
enable_plugin tricircle https://github.com/openstack/tricircle/
# Use Neutron instead of nova-network
disable_service n-net
enable_service q-svc
enable_service q-dhcp
enable_service q-agt
enable_service q-l3
enable_service c-api
enable_service c-vol
enable_service c-sch
disable_service n-obj
disable_service c-bak
disable_service tempest
disable_service horizon
CENTRAL_REGION_NAME=CentralRegion
TRICIRCLE_NEUTRON_PORT=20001
[[post-config|$NEUTRON_CONF]]
[DEFAULT]
core_plugin=tricircle.network.local_plugin.TricirclePlugin
[client]
admin_username=admin
admin_password=$ADMIN_PASSWORD
admin_tenant=demo
auto_refresh_endpoint=True
top_region_name=$CENTRAL_REGION_NAME
[tricircle]
real_core_plugin=neutron.plugins.ml2.plugin.Ml2Plugin
central_neutron_url=http://127.0.0.1:$TRICIRCLE_NEUTRON_PORT

View File

@ -2,14 +2,16 @@
# Sample DevStack local.conf.
#
# This sample file is intended to be used for your typical Tricircle DevStack
# multi-node environment. As this file configures, DevStack will setup one
# bottom region running original Nova, Cinder and Neutron.
# multi-node environment. As this file has configuration values for DevStack
# to result in RegionTwo running original Nova, Cinder and Neutron, and
# the local Neutron will be configured with Tricircle Local Neutron Plugin
# to work with central Neutron with Tricircle Central Neutron Plugin.
#
# This file works with local.conf.node_1.sample to help you build a two-node
# three-region Tricircle environment. Keystone and Glance in top region are
# shared by services in all the regions.
# three-region environment(CentralRegion, RegionOne and RegionTwo). Keystone in
# RegionOne is shared by services in all the regions.
#
# Some options needs to be change to adapt to your environment, see README.md
# Some options need to be changed to adapt to your environment, see README.rst
# for detail.
#
@ -20,22 +22,6 @@ RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
ADMIN_PASSWORD=password
LOGFILE=/opt/stack/logs/stack.sh.log
VERBOSE=True
LOG_COLOR=True
SCREEN_LOGDIR=/opt/stack/logs
FIXED_RANGE=10.0.0.0/24
NETWORK_GATEWAY=10.0.0.1
FIXED_NETWORK_SIZE=256
FLOATING_RANGE=10.100.100.160/24
Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192
PUBLIC_NETWORK_GATEWAY=10.100.100.3
Q_USE_SECGROUP=False
LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
NEUTRON_CREATE_INITIAL_NETWORKS=False
Q_USE_PROVIDERNET_FOR_PUBLIC=True
HOST_IP=10.250.201.25
REGION_NAME=RegionTwo
@ -45,41 +31,16 @@ KEYSTONE_SERVICE_HOST=10.250.201.24
KEYSTONE_AUTH_HOST=10.250.201.24
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=(network_vlan_ranges=bridge:2001:3000,extern:3001:4000)
OVS_BRIDGE_MAPPINGS=bridge:br-bridge,extern:br-ext
OVS_BRIDGE_MAPPINGS=bridge:br-vlan,extern:br-ext
# Use Neutron instead of nova-network
disable_service n-net
enable_service q-svc
enable_service q-dhcp
enable_service q-agt
enable_service q-l3
# Specify Central Region name
# CENTRAL_REGION_NAME=CentralRegion
enable_service c-api
enable_service c-vol
enable_service c-sch
# Specify port for central Neutron server
# TRICIRCLE_NEUTRON_PORT=20001
TRICIRCLE_START_SERVICES=False
enable_plugin tricircle https://github.com/openstack/tricircle/
disable_service n-obj
disable_service c-bak
disable_service tempest
disable_service horizon
CENTRAL_REGION_NAME=CentralRegion
TRICIRCLE_NEUTRON_PORT=20001
[[post-config|$NEUTRON_CONF]]
[DEFAULT]
core_plugin=tricircle.network.local_plugin.TricirclePlugin
service_plugins=tricircle.network.local_l3_plugin.TricircleL3Plugin
[client]
admin_username=admin
admin_password=$ADMIN_PASSWORD
admin_tenant=demo
auto_refresh_endpoint=True
top_region_name=$CENTRAL_REGION_NAME
[tricircle]
real_core_plugin=neutron.plugins.ml2.plugin.Ml2Plugin
# change the ip to the ip of the machine hosting central Neutron server
central_neutron_url=http://10.250.201.24:$TRICIRCLE_NEUTRON_PORT

View File

@ -54,6 +54,59 @@ function init_common_tricircle_conf {
iniset $conf_file oslo_concurrency lock_path $TRICIRCLE_STATE_PATH/lock
}
# common config-file configuration for local Neutron(s)
function init_local_neutron_conf {
iniset $NEUTRON_CONF DEFAULT core_plugin tricircle.network.local_plugin.TricirclePlugin
iniset $NEUTRON_CONF DEFAULT service_plugins tricircle.network.local_l3_plugin.TricircleL3Plugin
iniset $NEUTRON_CONF client admin_username admin
iniset $NEUTRON_CONF client admin_password $ADMIN_PASSWORD
iniset $NEUTRON_CONF client admin_tenant demo
iniset $NEUTRON_CONF client auto_refresh_endpoint True
iniset $NEUTRON_CONF client top_pod_name $CENTRAL_REGION_NAME
iniset $NEUTRON_CONF tricircle real_core_plugin neutron.plugins.ml2.plugin.Ml2Plugin
iniset $NEUTRON_CONF tricircle central_neutron_url http://$KEYSTONE_SERVICE_HOST:$TRICIRCLE_NEUTRON_PORT
}
# Set the environment variables for local Neutron(s)
function init_local_neutron_variables {
export Q_USE_PROVIDERNET_FOR_PUBLIC=True
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=${Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS:-}
# if VLAN options were not set in local.conf, use default VLAN bridge
# and VLAN options
if [ "$Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS" == "" ]; then
export TRICIRCLE_ADD_DEFAULT_BRIDGES=True
local vlan_option="bridge:$TRICIRCLE_DEFAULT_VLAN_RANGE"
local ext_option="extern:$TRICIRCLE_DEFAULT_EXT_RANGE"
local vlan_ranges=(network_vlan_ranges=$vlan_option)
if [ "$TRICIRCLE_START_SERVICES" == "False" ]; then
vlan_ranges=(network_vlan_ranges=$vlan_option,$ext_option)
fi
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=$vlan_ranges
local vlan_mapping="bridge:$TRICIRCLE_DEFAULT_VLAN_BRIDGE"
local ext_mapping="extern:$TRICIRCLE_DEFAULT_EXT_BRIDGE"
OVS_BRIDGE_MAPPINGS=$vlan_mapping
if [ "$TRICIRCLE_START_SERVICES" == "False" ]; then
OVS_BRIDGE_MAPPINGS=$vlan_mapping,$ext_mapping
fi
fi
}
function add_default_bridges {
if [ "$TRICIRCLE_ADD_DEFAULT_BRIDGES" == "True" ]; then
_neutron_ovs_base_add_bridge $TRICIRCLE_DEFAULT_VLAN_BRIDGE
_neutron_ovs_base_add_bridge $TRICIRCLE_DEFAULT_EXT_BRIDGE
fi
}
function configure_tricircle_api {
if is_service_enabled t-api ; then
@ -132,61 +185,77 @@ function start_central_neutron_server {
run_process q-svc$server_index "$NEUTRON_BIN_DIR/neutron-server --config-file $NEUTRON_CONF.$server_index --config-file /$Q_PLUGIN_CONF_FILE"
}
# if the plugin is enabled to run, that means the Tricircle is enabled
# by default, so no need to judge the variable Q_ENABLE_TRICIRCLE
if [[ "$Q_ENABLE_TRICIRCLE" == "True" ]]; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
echo summary "Tricircle pre-install"
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Tricircle"
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Tricircle"
export NEUTRON_CREATE_INITIAL_NETWORKS=False
sudo install -d -o $STACK_USER -m 755 $TRICIRCLE_CONF_DIR
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
echo_summary "Tricircle pre-install"
# init_local_neutron_variables before installation
init_local_neutron_variables
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Tricircle"
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Tricircle"
export NEUTRON_CREATE_INITIAL_NETWORKS=False
sudo install -d -o $STACK_USER -m 755 $TRICIRCLE_CONF_DIR
if [[ "$TRICIRCLE_START_SERVICES" == "True" ]]; then
enable_service t-api t-job
configure_tricircle_api
configure_tricircle_xjob
fi
echo export PYTHONPATH=\$PYTHONPATH:$TRICIRCLE_DIR >> $RC_DIR/.localrc.auto
echo export PYTHONPATH=\$PYTHONPATH:$TRICIRCLE_DIR >> $RC_DIR/.localrc.auto
setup_package $TRICIRCLE_DIR -e
setup_package $TRICIRCLE_DIR -e
if [[ "$TRICIRCLE_START_SERVICES" == "True" ]]; then
recreate_database tricircle
tricircle-db-manage "$TRICIRCLE_API_CONF"
if is_service_enabled q-svc ; then
start_central_neutron_server $CENTRAL_REGION_NAME $TRICIRCLE_NEUTRON_PORT
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Tricircle Service"
if is_service_enabled t-api; then
create_tricircle_accounts
run_process t-api "tricircle-api --config-file $TRICIRCLE_API_CONF"
fi
if is_service_enabled t-job; then
run_process t-job "tricircle-xjob --config-file $TRICIRCLE_XJOB_CONF"
fi
fi
if [[ "$1" == "unstack" ]]; then
# update the local neutron.conf after the central Neutron has started
init_local_neutron_conf
if is_service_enabled t-api; then
stop_process t-api
fi
# add default bridges br-vlan, br-ext if needed, ovs-vsctl
# is just being installed before this stage
add_default_bridges
if is_service_enabled t-job; then
stop_process t-job
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Tricircle Service"
if is_service_enabled q-svc0; then
stop_process q-svc0
fi
if is_service_enabled t-api; then
create_tricircle_accounts
run_process t-api "tricircle-api --config-file $TRICIRCLE_API_CONF"
fi
if is_service_enabled t-job; then
run_process t-job "tricircle-xjob --config-file $TRICIRCLE_XJOB_CONF"
fi
fi
if [[ "$1" == "unstack" ]]; then
if is_service_enabled t-api; then
stop_process t-api
fi
if is_service_enabled t-job; then
stop_process t-job
fi
if is_service_enabled q-svc0; then
stop_process q-svc0
fi
fi

View File

@ -6,6 +6,15 @@ TRICIRCLE_BRANCH=${TRICIRCLE_BRANCH:-master}
# common variables
CENTRAL_REGION_NAME=${CENTRAL_REGION_NAME:-CentralRegion}
TRICIRCLE_NEUTRON_PORT=${TRICIRCLE_NEUTRON_PORT:-20001}
TRICIRCLE_START_SERVICES=${TRICIRCLE_START_SERVICES:-True}
# these default settings are used for devstack based gate/check jobs
TRICIRCLE_DEFAULT_VLAN_BRIDGE=${TRICIRCLE_DEFAULT_VLAN_BRIDGE:-br-vlan}
TRICIRCLE_DEFAULT_VLAN_RANGE=${TRICIRCLE_DEFAULT_VLAN_RANGE:-101:150}
TRICIRCLE_DEFAULT_EXT_BRIDGE=${TRICIRCLE_DEFAULT_EXT_BRIDGE:-br-ext}
TRICIRCLE_DEFAULT_EXT_RANGE=${TRICIRCLE_DEFAULT_EXT_RANGE:-151:200}
TRICIRCLE_ADD_DEFAULT_BRIDGES=${TRICIRCLE_ADD_DEFAULT_BRIDGES:-False}
TRICIRCLE_CONF_DIR=${TRICIRCLE_CONF_DIR:-/etc/tricircle}
TRICIRCLE_STATE_PATH=${TRICIRCLE_STATE_PATH:-/var/lib/tricircle}

View File

@ -83,7 +83,8 @@ for installing DevStack in virtual machine.
Setup
^^^^^
In pod1 in node1,
In pod1 in node1 for Tricircle service, central Neutron and OpenStack
RegionOne,
- 1 Install DevStack. Please refer to
`DevStack document <http://docs.openstack.org/developer/devstack/>`_
@ -108,22 +109,22 @@ In pod1 in node1,
Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS=(network_vlan_ranges=bridge:2001:3000)
- the format of OVS_BRIDGE_MAPPINGS is <physical network name>:<ovs bridge name>,
you can change these names, but remember to adapt your change to the commands
showed in this guide::
you can change these names, but remember to adapt your change to the
commands showed in this guide::
OVS_BRIDGE_MAPPINGS=bridge:br-bridge
OVS_BRIDGE_MAPPINGS=bridge:br-vlan
- set Q_USE_PROVIDERNET_FOR_PUBLIC to True(it's False by default) if you would
like to try l3 north-south networking::
- set TRICIRCLE_START_SERVICES to True to install the Tricircle service and
central Neutron in node1::
Q_USE_PROVIDERNET_FOR_PUBLIC=True
TRICIRCLE_START_SERVICES=True
- 4 Create OVS bridge and attach the VLAN network interface to it ::
sudo ovs-vsctl add-br br-bridge
sudo ovs-vsctl add-port br-bridge eth1
sudo ovs-vsctl add-br br-vlan
sudo ovs-vsctl add-port br-vlan eth1
br-bridge is the OVS bridge name you configure on OVS_PHYSICAL_BRIDGE, eth1 is
br-vlan is the OVS bridge name you configure on OVS_PHYSICAL_BRIDGE, eth1 is
the device name of your VLAN network interface
- 5 Run DevStack. In DevStack folder, run ::
@ -132,7 +133,7 @@ In pod1 in node1,
- 6 After DevStack successfully starts, begin to setup node2.
In pod2 in node2,
In pod2 in node2 for OpenStack RegionTwo,
- 1 Install DevStack. Please refer to
`DevStack document <http://docs.openstack.org/developer/devstack/>`_
@ -168,16 +169,12 @@ In pod2 in node2,
you can change these names, but remember to adapt your change to the commands
showed in this guide::
OVS_BRIDGE_MAPPINGS=bridge:br-bridge,extern:br-ext
OVS_BRIDGE_MAPPINGS=bridge:br-vlan,extern:br-ext
- set Q_USE_PROVIDERNET_FOR_PUBLIC to True(it's False by default) if you would
like to try l3 north-south networking::
- set TRICIRCLE_START_SERVICES to False(it's True by default) so Tricircle
services and central Neutron will not be started in node2::
Q_USE_PROVIDERNET_FOR_PUBLIC=True
- change the ip in central_neutron_url to management interface ip of node1::
central_neutron_url=http://10.250.201.24:$TRICIRCLE_NEUTRON_PORT
TRICIRCLE_START_SERVICES=False
In this guide, we define two physical networks in node2, one is "bridge" for
bridge network, the other one is "extern" for external network. If you do not
@ -188,29 +185,20 @@ In pod2 in node2,
- 4 Create OVS bridge and attach the VLAN network interface to it ::
sudo ovs-vsctl add-br br-bridge
sudo ovs-vsctl add-port br-bridge eth1
sudo ovs-vsctl add-br br-vlan
sudo ovs-vsctl add-port br-vlan eth1
sudo ovs-vsctl add-br br-ext
sudo ovs-vsctl add-port br-ext eth2
br-bridge and br-ext are the OVS bridge names you configure on
br-vlan and br-ext are the OVS bridge names you configure on
OVS_PHYSICAL_BRIDGE, eth1 and eth2 are the device names of your VLAN network
interfaces, for the "bridge" network and the external network.
- 5 In /opt/stack folder (create this folder if it does not exist), then run ::
git clone https://github.com/openstack/tricircle
- 6 After the Tricircle source code is cloned, install Tricircle manually ::
cd tricircle/
sudo pip install -e .
- 7 Run DevStack. In DevStack folder, run ::
- 5 Run DevStack. In DevStack folder, run ::
./stack.sh
- 8 After DevStack successfully starts, the setup is finished.
- 6 After DevStack successfully starts, the setup is finished.
How to play
^^^^^^^^^^^