Add devstack plugin for octavia
Co-Authored-By: Phillip Toohill <phillip.toohill@rackspace.com> Change-Id: I9f8c87cd39ef59db71fe3a93b09f905f71dd2feb
This commit is contained in:
parent
88228c4272
commit
4ac7376c2f
|
@ -0,0 +1,30 @@
|
|||
This directory contains the octavia devstack plugin. To
|
||||
configure the neutron load balancer with octavia, in the [[local|localrc]] section
|
||||
you will need to enable the neutron-lbaas and octavia devstack plugins and enable
|
||||
the LBaaS and octavia services by editing the [[local|localrc]] section of your
|
||||
local.conf file.
|
||||
|
||||
1) Enable the plugin
|
||||
|
||||
To enable the octavia plugin, add a line of the form:
|
||||
|
||||
enable_plugin octavia <GITURL> [GITREF]
|
||||
|
||||
where
|
||||
|
||||
<GITURL> is the URL of a octavia repository
|
||||
[GITREF] is an optional git ref (branch/ref/tag). The default is
|
||||
master.
|
||||
|
||||
For example
|
||||
|
||||
enable_plugin octavia https://git.openstack.org/stackforge/octavia master
|
||||
|
||||
2) Enable the LBaaS Version 2 and Octavia services
|
||||
|
||||
For example
|
||||
|
||||
ENABLED_SERVICES+=q-lbaasv2,octavia,o-api,o-cw,o-hk,o-hm
|
||||
|
||||
For more information, see the "Externally Hosted Plugins" section of
|
||||
http://docs.openstack.org/developer/devstack/plugins.html.
|
|
@ -0,0 +1,208 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# devstack plugin for octavia
|
||||
|
||||
function octavia_install {
|
||||
|
||||
setup_develop $OCTAVIA_DIR
|
||||
sudo apt-get -y install qemu kpartx
|
||||
git_clone https://git.openstack.org/openstack/diskimage-builder.git $DEST/diskimage-builder master
|
||||
git_clone https://git.openstack.org/openstack/tripleo-image-elements.git $DEST/tripleo-image-elements master
|
||||
sudo pip install -r $DEST/diskimage-builder/requirements.txt
|
||||
}
|
||||
|
||||
function build_octavia_worker_image {
|
||||
|
||||
TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
|
||||
die_if_not_set $LINENO TOKEN "Keystone failed to get token."
|
||||
|
||||
# TODO(ptoohill): Tempfix..? -o option stopped working and it no longer saves image to working dir...
|
||||
if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then
|
||||
$OCTAVIA_DIR/diskimage-create/diskimage-create.sh
|
||||
# $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -o $OCTAVIA_AMP_IMAGE_NAME
|
||||
fi
|
||||
upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN
|
||||
# upload_image file://${OCTAVIA_AMP_IMAGE_NAME}.qcow2 $TOKEN
|
||||
}
|
||||
|
||||
function octavia_configure {
|
||||
|
||||
sudo mkdir -m 755 -p $OCTAVIA_CONF_DIR
|
||||
safe_chown $STACK_USER $OCTAVIA_CONF_DIR
|
||||
|
||||
if ! [ -e $OCTAVIA_CONF ] ; then
|
||||
cp $OCTAVIA_DIR/etc/octavia.conf $OCTAVIA_CONF
|
||||
fi
|
||||
|
||||
iniset $OCTAVIA_CONF database connection "mysql+pymysql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:3306/octavia"
|
||||
|
||||
iniset $OCTAVIA_CONF keystone_authtoken auth_uri ${KEYSTONE_AUTH_URI}/v2.0
|
||||
iniset $OCTAVIA_CONF keystone_authtoken admin_user ${OCTAVIA_ADMIN_USER}
|
||||
iniset $OCTAVIA_CONF keystone_authtoken admin_tenant_name ${OCTAVIA_ADMIN_TENANT_NAME}
|
||||
iniset $OCTAVIA_CONF keystone_authtoken admin_password ${OCTAVIA_ADMIN_PASSWORD}
|
||||
iniset $OCTAVIA_CONF keystone_authtoken auth_version ${OCTAVIA_AUTH_VERSION}
|
||||
|
||||
iniset $OCTAVIA_CONF controller_worker amp_flavor_id ${OCTAVIA_AMP_FLAVOR_ID}
|
||||
|
||||
# Setting other required default options
|
||||
iniset $OCTAVIA_CONF controller_worker amphora_driver amphora_haproxy_ssh_driver
|
||||
iniset $OCTAVIA_CONF controller_worker compute_driver compute_nova_driver
|
||||
iniset $OCTAVIA_CONF controller_worker network_driver allowed_address_pairs_driver
|
||||
|
||||
iniset $OCTAVIA_CONF DEFAULT api_handler queue_producer
|
||||
|
||||
iniset $OCTAVIA_CONF oslo_messaging rabbit_port 5672
|
||||
iniset $OCTAVIA_CONF oslo_messaging rabbit_hosts localhost:5672
|
||||
iniset $OCTAVIA_CONF oslo_messaging rpc_thread_pool_size 2
|
||||
iniset $OCTAVIA_CONF oslo_messaging topic octavia_prov
|
||||
|
||||
# Uncomment other default options
|
||||
iniuncomment $OCTAVIA_CONF haproxy_amphora username
|
||||
iniuncomment $OCTAVIA_CONF haproxy_amphora base_path
|
||||
iniuncomment $OCTAVIA_CONF haproxy_amphora base_cert_dir
|
||||
iniuncomment $OCTAVIA_CONF haproxy_amphora connection_max_retries
|
||||
iniuncomment $OCTAVIA_CONF haproxy_amphora connection_retry_interval
|
||||
|
||||
if [[ -a $OCTAVIA_SSH_DIR ]] ; then
|
||||
rm -rf $OCTAVIA_SSH_DIR
|
||||
fi
|
||||
|
||||
mkdir -m755 $OCTAVIA_SSH_DIR
|
||||
ssh-keygen -b $OCTAVIA_AMP_SSH_KEY_BITS -t $OCTAVIA_AMP_SSH_KEY_TYPE -N "" -f ${OCTAVIA_AMP_SSH_KEY_PATH}
|
||||
iniset $OCTAVIA_CONF controller_worker amp_ssh_key_name ${OCTAVIA_AMP_SSH_KEY_NAME}
|
||||
|
||||
# Used to communicate with the amphora over the mgmt network, may differ from amp_ssh_key in a real deployment.
|
||||
iniset $OCTAVIA_CONF haproxy_amphora key_path ${OCTAVIA_AMP_SSH_KEY_PATH}
|
||||
|
||||
recreate_database_mysql octavia
|
||||
alembic -c $OCTAVIA_DIR/octavia/db/migration/alembic.ini upgrade head
|
||||
}
|
||||
|
||||
function build_mgmt_network {
|
||||
# Create network and attach a subnet
|
||||
OCTAVIA_AMP_NETWORK_ID=$(neutron net-create lb-mgmt-net | awk '/ id / {print $4}')
|
||||
OCTAVIA_AMP_SUBNET_ID=$(neutron subnet-create --name lb-mgmt-subnet --allocation-pool start=$OCTAVIA_MGMT_SUBNET_START,end=$OCTAVIA_MGMT_SUBNET_END lb-mgmt-net $OCTAVIA_MGMT_SUBNET | awk '/ id / {print $4}')
|
||||
|
||||
# Create security group and rules
|
||||
neutron security-group-create lb-mgmt-sec-grp
|
||||
neutron security-group-rule-create --protocol icmp lb-mgmt-sec-grp
|
||||
neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 lb-mgmt-sec-grp
|
||||
|
||||
OCTAVIA_MGMT_SEC_GRP_ID=$(nova secgroup-list | awk ' / lb-mgmt-sec-grp / {print $2}')
|
||||
iniset ${OCTAVIA_CONF} controller_worker amp_secgroup_list ${OCTAVIA_MGMT_SEC_GRP_ID}
|
||||
|
||||
neutron router-interface-add router1 lb-mgmt-subnet
|
||||
sudo ip route add ${OCTAVIA_MGMT_SUBNET} via $(neutron subnet-show public-subnet | awk ' / allocation_pools / {print $5}' | tr -d '",') dev br-ex
|
||||
}
|
||||
|
||||
function configure_octavia_tempest {
|
||||
# Load the amp_network_list to tempest.conf and copy to tree
|
||||
|
||||
# TODO (ptoohill): remove check when tempest structure merges
|
||||
if ! [ $OCTAVIA_TEMPEST == 'disabled' ] ; then
|
||||
iniset $TEMPEST_CONFIG controller_worker amp_network $1
|
||||
cp $TEMPEST_CONFIG $OCTAVIA_TEMPEST_DIR/etc
|
||||
fi
|
||||
}
|
||||
|
||||
function octavia_start {
|
||||
|
||||
# Several steps in this function would more logically be in the configure function, but
|
||||
# we need nova, glance, and neutron to be running.
|
||||
|
||||
nova keypair-add --pub-key ${OCTAVIA_AMP_SSH_KEY_PATH}.pub ${OCTAVIA_AMP_SSH_KEY_NAME}
|
||||
|
||||
build_octavia_worker_image
|
||||
|
||||
OCTAVIA_AMP_IMAGE_ID=$(glance image-list | grep ${OCTAVIA_AMP_IMAGE_NAME} | awk '{print $2}')
|
||||
iniset $OCTAVIA_CONF controller_worker amp_image_id ${OCTAVIA_AMP_IMAGE_ID}
|
||||
|
||||
# Create a management network.
|
||||
build_mgmt_network
|
||||
OCTAVIA_AMP_NETWORK_ID=$(neutron net-list | awk '/ lb-mgmt-net / {print $2}')
|
||||
|
||||
iniset $OCTAVIA_CONF controller_worker amp_network ${OCTAVIA_AMP_NETWORK_ID}
|
||||
|
||||
if is_service_enabled tempest; then
|
||||
configure_octavia_tempest ${OCTAVIA_AMP_NETWORK_ID}
|
||||
fi
|
||||
|
||||
run_process $OCTAVIA_API "$OCTAVIA_API_BINARY $OCTAVIA_API_ARGS"
|
||||
run_process $OCTAVIA_CONSUMER "$OCTAVIA_CONSUMER_BINARY $OCTAVIA_CONSUMER_ARGS"
|
||||
run_process $OCTAVIA_HOUSEKEEPER "$OCTAVIA_HOUSEKEEPER_BINARY $OCTAVIA_HOUSEKEEPER_ARGS"
|
||||
run_process $OCTAVIA_HEALTHMANAGER "$OCTAVIA_HEALTHMANAGER_BINARY $OCTAVIA_HEALTHMANAGER_ARGS"
|
||||
|
||||
}
|
||||
|
||||
function octavia_stop {
|
||||
# octavia-specific stop actions
|
||||
# TODO (ajmiller): If octavia behaves similarly to the neutron-lbaas driver,
|
||||
# there will be haproxy processes running as daemons. The neutron-lbaas stop
|
||||
# code searches for and kills all haproxy procs. That seems like a very
|
||||
# blunt club, is there a better way to do this?
|
||||
pids=$(ps aux | awk '/haproxy/ { print $2 }')
|
||||
[ ! -z "$pids" ] && sudo kill $pids
|
||||
}
|
||||
|
||||
function octavia_cleanup {
|
||||
|
||||
if [ ${OCTAVIA_AMP_IMAGE_NAME}x != x ] ; then
|
||||
rm -rf ${OCTAVIA_AMP_IMAGE_NAME}*
|
||||
fi
|
||||
if [ ${OCTAVIA_AMP_SSH_KEY_NAME}x != x ] ; then
|
||||
rm -f ${OCTAVIA_AMP_SSH_KEY_NAME}*
|
||||
fi
|
||||
if [ ${OCTAVIA_SSH_DIR}x != x ] ; then
|
||||
rm -rf ${OCTAVIA_SSH_DIR}
|
||||
fi
|
||||
if [ ${OCTAVIA_CONF_DIR}x != x ] ; then
|
||||
sudo rm -rf ${OCTAVIA_CONF_DIR}
|
||||
fi
|
||||
if [ ${OCTAVIA_AMP_SSH_KEY_PATH}x != x ] ; then
|
||||
rm -f ${OCTAVIA_AMP_SSH_KEY_PATH} ${OCTAVIA_AMP_SSH_KEY_PATH}.pub
|
||||
fi
|
||||
if [ ${OCTAVIA_AMP_SSH_KEY_NAME}x != x ] ; then
|
||||
nova keypair-delete ${OCTAVIA_AMP_SSH_KEY_NAME}
|
||||
fi
|
||||
}
|
||||
|
||||
# check for service enabled
|
||||
if is_service_enabled $OCTAVIA; then
|
||||
|
||||
if ! is_service_enabled $Q_SVC || ! is_service_enabled $LBAAS_V2; then
|
||||
die "The neutron $Q-SVC and $LBAAS_V2 services must be enabled to use $OCTAVIA"
|
||||
fi
|
||||
|
||||
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
# Perform installation of service source
|
||||
echo_summary "Installing octavia"
|
||||
octavia_install
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
# Configure after the other layer 1 and 2 services have been configured
|
||||
# TODO: need to make sure this runs after LBaaS V2 configuration
|
||||
echo_summary "Configuring octavia"
|
||||
octavia_configure
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
# Initialize and start the octavia service
|
||||
echo_summary "Initializing octavia"
|
||||
octavia_start
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
# Shut down Octavia services
|
||||
if is_service_enabled $OCTAVIA; then
|
||||
echo_summary "Stopping octavia"
|
||||
octavia_stop
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$1" == "clean" ]]; then
|
||||
# Remember clean.sh first calls unstack.sh
|
||||
if is_service_enabled $OCTAVIA; then
|
||||
echo_summary "Cleaning up octavia"
|
||||
octavia_cleanup
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,37 @@
|
|||
This file describes how to use Vagrant (http://www.vagrantup.com) to
|
||||
create a devstack virtual machine that contains two nova instances
|
||||
running a simple web server and a working Neutron LBaaS Version 2 load
|
||||
balancer backed by Octavia.
|
||||
|
||||
1) Install vagrant on your host machine. Vagrant is available for
|
||||
Windows, Mac OS, and most Linux distributions. Download and install
|
||||
the package appropriate for your system. On Ubuntu, simply type:
|
||||
|
||||
sudo apt-get install vagrant
|
||||
|
||||
2) copy 'Vagrantfile' from this directory to any appropriate directory
|
||||
and run 'vagrant up':
|
||||
|
||||
mkdir $HOME/lbaas-octavia-vagrant # or any other appropriate directory
|
||||
cp Vagrantfile $HOME/lbaas-octavia-vagrant
|
||||
cd $HOME/lbaas-octavia-vagrant
|
||||
vagrant up
|
||||
|
||||
3) Wait for the vagrant VM to boot and install, typically 20-30 minutes
|
||||
|
||||
4) SSH into the vagrant box
|
||||
|
||||
vagrant ssh
|
||||
|
||||
5) Determine the loadbalancer IP:
|
||||
|
||||
source openrc admin admin
|
||||
neutron lbaas-loadbalancer-show lb1 | grep vip_address
|
||||
|
||||
6) make HTTP requests to test your load balancer:
|
||||
|
||||
curl <LB_IP>
|
||||
|
||||
where <LB_IP> is the VIP address for lb1. The subsequent invocations of
|
||||
"curl <LB_IP>" should demonstrate that the load balancer is alternating
|
||||
between two member nodes.
|
|
@ -0,0 +1,84 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
# The most common configuration options are documented and commented below.
|
||||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://atlas.hashicorp.com/search.
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
#config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
# Display the VirtualBox GUI when booting the machine
|
||||
vb.gui = true
|
||||
# Customize the amount of memory on the VM:
|
||||
vb.memory = "8192"
|
||||
end
|
||||
#
|
||||
# View the documentation for the provider you are using for more
|
||||
# information on available options
|
||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
||||
# such as FTP and Heroku are also available. See the documentation at
|
||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||
# config.push.define "atlas" do |push|
|
||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||
# end
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
config.vm.provision "shell", privileged: false, inline: <<-SHELL
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install git
|
||||
|
||||
git clone https://git.openstack.org/openstack-dev/devstack
|
||||
git clone https://git.openstack.org/stackforge/octavia
|
||||
cd octavia
|
||||
git fetch https://review.openstack.org/stackforge/octavia refs/changes/96/167796/26 && git checkout FETCH_HEAD
|
||||
cd devstack/samples
|
||||
cp local.* webserver.sh ~/devstack
|
||||
cd ~/devstack
|
||||
./stack.sh
|
||||
|
||||
SHELL
|
||||
|
||||
end
|
|
@ -0,0 +1,111 @@
|
|||
# Sample ``local.conf`` that builds a devstack with neutron LBaaS Version 2
|
||||
|
||||
# NOTE: Copy this file to the root DevStack directory for it to work properly.
|
||||
|
||||
# ``local.conf`` is a user-maintained settings file that is sourced from ``stackrc``.
|
||||
# This gives it the ability to override any variables set in ``stackrc``.
|
||||
# Also, most of the settings in ``stack.sh`` are written to only be set if no
|
||||
# value has already been set; this lets ``local.conf`` effectively override the
|
||||
# default values.
|
||||
|
||||
# The ``localrc`` section replaces the old ``localrc`` configuration file.
|
||||
# Note that if ``localrc`` is present it will be used in favor of this section.
|
||||
|
||||
[[local|localrc]]
|
||||
|
||||
# The name of the RECLONE environment variable is a bit misleading. It doesn't actually
|
||||
# reclone repositories, rather it uses git fetch to make sure the repos are current.
|
||||
|
||||
RECLONE=True
|
||||
|
||||
# Load the external LBaaS plugin.
|
||||
|
||||
enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas
|
||||
enable_plugin octavia https://git.openstack.org/stackforge/octavia refs/changes/96/167796/27
|
||||
|
||||
LIBS_FROM_GIT+=python-neutronclient
|
||||
DATABASE_PASSWORD=password
|
||||
ADMIN_PASSWORD=password
|
||||
SERVICE_PASSWORD=password
|
||||
SERVICE_TOKEN=password
|
||||
RABBIT_PASSWORD=password
|
||||
# Enable Logging
|
||||
LOGFILE=$DEST/logs/stack.sh.log
|
||||
VERBOSE=True
|
||||
LOG_COLOR=True
|
||||
SCREEN_LOGDIR=$DEST/logs
|
||||
|
||||
# Pre-requisites
|
||||
enable_service rabbit
|
||||
enable_service mysql
|
||||
enable_service key
|
||||
|
||||
# Horizon
|
||||
enable_service horizon
|
||||
|
||||
# Nova
|
||||
enable_service n-api
|
||||
enable_service n-crt
|
||||
enable_service n-obj
|
||||
enable_service n-cpu
|
||||
enable_service n-cond
|
||||
enable_service n-sch
|
||||
|
||||
# Glance
|
||||
enable_service g-api
|
||||
enable_service g-reg
|
||||
|
||||
# Neutron
|
||||
enable_service q-svc
|
||||
enable_service q-agt
|
||||
enable_service q-dhcp
|
||||
enable_service q-l3
|
||||
enable_service q-meta
|
||||
|
||||
# Cinder
|
||||
enable_service c-api
|
||||
enable_service c-vol
|
||||
enable_service c-sch
|
||||
|
||||
|
||||
# LBaaS V2 and Octavia
|
||||
enable_service q-lbaasv2
|
||||
enable_service octavia
|
||||
enable_service o-cw
|
||||
enable_service o-hm
|
||||
enable_service o-hk
|
||||
enable_service o-api
|
||||
|
||||
|
||||
# enable DVR
|
||||
|
||||
Q_PLUGIN=ml2
|
||||
Q_ML2_TENANT_NETWORK_TYPE=vxlan
|
||||
Q_DVR_MODE=dvr_snat
|
||||
|
||||
IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
|
||||
|
||||
LOGFILE=$DEST/logs/stack.sh.log
|
||||
|
||||
# Old log files are automatically removed after 7 days to keep things neat. Change
|
||||
# the number of days by setting ``LOGDAYS``.
|
||||
LOGDAYS=2
|
||||
|
||||
# Swift
|
||||
# -----
|
||||
|
||||
# Swift is now used as the back-end for the S3-like object store. If Nova's
|
||||
# objectstore (``n-obj`` in ``ENABLED_SERVICES``) is enabled, it will NOT
|
||||
# run if Swift is enabled. Setting the hash value is required and you will
|
||||
# be prompted for it if Swift is enabled so just set it to something already:
|
||||
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
|
||||
|
||||
# For development purposes the default of 3 replicas is usually not required.
|
||||
# Set this to 1 to save some resources:
|
||||
SWIFT_REPLICAS=1
|
||||
|
||||
# The data for Swift is stored by default in (``$DEST/data/swift``),
|
||||
# or (``$DATA_DIR/swift``) if ``DATA_DIR`` has been set, and can be
|
||||
# moved by setting ``SWIFT_DATA_DIR``. The directory will be created
|
||||
# if it does not exist.
|
||||
SWIFT_DATA_DIR=$DEST/data
|
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Sample ``local.sh`` that configures two simple webserver instances and sets
|
||||
# up a Neutron LBaaS Version 2 loadbalancer backed by Octavia.
|
||||
|
||||
# Keep track of the DevStack directory
|
||||
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
||||
BOOT_DELAY=60
|
||||
|
||||
# Import common functions
|
||||
source ${TOP_DIR}/functions
|
||||
|
||||
# Use openrc + stackrc for settings
|
||||
source ${TOP_DIR}/stackrc
|
||||
|
||||
# Destination path for installation ``DEST``
|
||||
DEST=${DEST:-/opt/stack}
|
||||
|
||||
if is_service_enabled nova; then
|
||||
|
||||
# Get OpenStack demo user auth
|
||||
source ${TOP_DIR}/openrc demo demo
|
||||
|
||||
# Create an SSH key to use for the instances
|
||||
DEVSTACK_LBAAS_SSH_KEY_NAME=$(hostname)_DEVSTACK_LBAAS_SSH_KEY_RSA
|
||||
DEVSTACK_LBAAS_SSH_KEY_DIR=${TOP_DIR}
|
||||
DEVSTACK_LBAAS_SSH_KEY=${DEVSTACK_LBAAS_SSH_KEY_DIR}/${DEVSTACK_LBAAS_SSH_KEY_NAME}
|
||||
rm -f ${DEVSTACK_LBAAS_SSH_KEY}.pub ${DEVSTACK_LBAAS_SSH_KEY}
|
||||
ssh-keygen -b 2048 -t rsa -f ${DEVSTACK_LBAAS_SSH_KEY} -N ""
|
||||
nova keypair-add --pub_key=${DEVSTACK_LBAAS_SSH_KEY}.pub ${DEVSTACK_LBAAS_SSH_KEY_NAME}
|
||||
|
||||
# Add tcp/22,80 and icmp to default security group
|
||||
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
|
||||
nova secgroup-add-rule default tcp 80 80 0.0.0.0/0
|
||||
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
|
||||
|
||||
# Boot some instances
|
||||
NOVA_BOOT_ARGS="--key-name ${DEVSTACK_LBAAS_SSH_KEY_NAME} --image $(nova image-list | awk '/ cirros-0.3.0-x86_64-disk / {print $2}') --flavor 1 --nic net-id=$(neutron net-list | awk '/ private / {print $2}')"
|
||||
|
||||
nova boot ${NOVA_BOOT_ARGS} node1
|
||||
nova boot ${NOVA_BOOT_ARGS} node2
|
||||
|
||||
echo "Waiting ${BOOT_DELAY} seconds for instances to boot"
|
||||
sleep ${BOOT_DELAY}
|
||||
|
||||
IP1=$(nova show node1 | grep "private network" | awk '{print $5}')
|
||||
IP2=$(nova show node2 | grep "private network" | awk '{print $5}')
|
||||
|
||||
ssh-keygen -R ${IP1}
|
||||
ssh-keygen -R ${IP2}
|
||||
|
||||
# Run a simple web server on the instances
|
||||
scp -i ${DEVSTACK_LBAAS_SSH_KEY} -o StrictHostKeyChecking=no ${TOP_DIR}/webserver.sh cirros@${IP1}:webserver.sh
|
||||
scp -i ${DEVSTACK_LBAAS_SSH_KEY} -o StrictHostKeyChecking=no ${TOP_DIR}/webserver.sh cirros@${IP2}:webserver.sh
|
||||
|
||||
screen_process node1 "ssh -i ${DEVSTACK_LBAAS_SSH_KEY} -o StrictHostKeyChecking=no cirros@${IP1} ./webserver.sh"
|
||||
screen_process node2 "ssh -i ${DEVSTACK_LBAAS_SSH_KEY} -o StrictHostKeyChecking=no cirros@${IP2} ./webserver.sh"
|
||||
|
||||
fi
|
||||
|
||||
if is_service_enabled q-lbaasv2; then
|
||||
|
||||
neutron lbaas-loadbalancer-create --name lb1 private-subnet
|
||||
sleep 10
|
||||
neutron lbaas-listener-create --loadbalancer lb1 --protocol HTTP --protocol-port 80 --name listener1
|
||||
sleep 10
|
||||
neutron lbaas-pool-create --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP --name pool1
|
||||
neutron lbaas-member-create --subnet private-subnet --address ${IP1} --protocol-port 80 pool1
|
||||
neutron lbaas-member-create --subnet private-subnet --address ${IP2} --protocol-port 80 pool1
|
||||
|
||||
fi
|
|
@ -0,0 +1,50 @@
|
|||
# settings for octavia devstack plugin
|
||||
|
||||
OCTAVIA=${OCTAVIA:-"octavia"}
|
||||
OCTAVIA_DIR=${OCTAVIA_DIR:-"${DEST}/octavia"}
|
||||
OCTAVIA_BIN_DIR=${OCTAVIA_BIN_DIR:-$(get_python_exec_prefix)}
|
||||
OCTAVIA_CONF_DIR=${OCTAVIA_CONF_DIR:-"/etc/octavia"}
|
||||
OCTAVIA_SSH_DIR=${OCTAVIA_SSH_DIR:-${OCTAVIA_CONF_DIR}/.ssh}
|
||||
OCTAVIA_CONF=${OCTAVIA_CONF:-${OCTAVIA_CONF_DIR}/octavia.conf}
|
||||
OCTAVIA_TEMPEST_DIR=${OCTAVIA_TEMPEST_DIR:-${OCTAVIA_DIR}/octavia/tests/tempest}
|
||||
|
||||
OCTAVIA_USER=${OCTAVIA_USER:-${ADMIN_USER}}
|
||||
OCTAVIA_PASSWORD=${OCTAVIA_PASSWORD:-${ADMIN_PASSWORD}}
|
||||
OCTAVIA_TENANT_ID=${OCTAVIA_TENANT_ID:-${ADMIN_TENANT_ID}}
|
||||
OCTAVIA_AUTH_VERSION=${OCTAVIA_AUTH_VERSION:-"2"}
|
||||
OCTAVIA_ADMIN_USER=${OCTAVIA_ADMIN_USER:-"admin"}
|
||||
OCTAVIA_ADMIN_TENANT_NAME=${OCTAVIA_ADMIN_TENANT_NAME:-"admin"}
|
||||
OCTAVIA_ADMIN_PASSWORD=${OCTAVIA_ADMIN_PASSWORD:-"password"}
|
||||
|
||||
OCTAVIA_MGMT_SUBNET=${OCTAVIA_MGMT_SUBNET:-"192.168.0.0/24"}
|
||||
OCTAVIA_MGMT_SUBNET_START=${OCTAVIA_MGMT_SUBNET_START:-"192.168.0.2"}
|
||||
OCTAVIA_MGMT_SUBNET_END=${OCTAVIA_MGMT_SUBNET_END:-"192.168.0.200"}
|
||||
|
||||
OCTAVIA_AMP_SSH_KEY_BITS=${OCTAVIA_SSH_KEY_BITS:-"2048"}
|
||||
OCTAVIA_AMP_SSH_KEY_TYPE=${OCTAVIA_SSH_KEY_TYPE:-"rsa"}
|
||||
OCTAVIA_AMP_SSH_KEY_PATH=${OCTAVIA_SSH_KEY_PATH:-${OCTAVIA_SSH_DIR}/octavia_ssh_key}
|
||||
OCTAVIA_AMP_SSH_KEY_NAME=${OCTAVIA_AMP_SSH_KEY_NAME:-"octavia_ssh_key"}
|
||||
|
||||
OCTAVIA_AMP_FLAVOR_ID=${OCTAVIA_AMP_FLAVOR_ID:-"2"}
|
||||
OCTAVIA_AMP_IMAGE_NAME=${OCTAVIA_AMP_IMAGE_NAME:-"amphora-x64-haproxy"}
|
||||
OCTAVIA_AMP_IMAGE_FILE=${OCTAVIA_AMP_IMAGE_FILE:-${OCTAVIA_DIR}/diskimage-create/${OCTAVIA_AMP_IMAGE_NAME}.qcow2}
|
||||
|
||||
OCTAVIA_API_BINARY=${OCTAVIA_API_BINARY:-${OCTAVIA_BIN_DIR}/octavia-api}
|
||||
OCTAVIA_CONSUMER_BINARY=${OCTAVIA_CONSUMER_BINARY:-${OCTAVIA_BIN_DIR}/octavia-worker}
|
||||
OCTAVIA_HOUSEKEEPER_BINARY=${OCTAVIA_HOUSEKEEPER_BINARY:-${OCTAVIA_BIN_DIR}/housekeeper}
|
||||
OCTAVIA_HEALTHMANAGER_BINARY=${OCTAVIA_HEALTHMANAGER_BINARY:-${OCTAVIA_BIN_DIR}/health_manager_service}
|
||||
|
||||
OCTAVIA_API_ARGS=${OCTAVIA_API_ARGS:-" --config-file $OCTAVIA_CONF"}
|
||||
OCTAVIA_CONSUMER_ARGS=${OCTAVIA_CONSUMER_ARGS:-" --config-file $OCTAVIA_CONF"}
|
||||
OCTAVIA_HOUSEKEEPER_ARGS=${OCTAVIA_HOUSEKEEPER_ARGS:-" --config-file $OCTAVIA_CONF"}
|
||||
OCTAVIA_HEALTHMANAGER_ARGS=${OCTAVIA_HEALTHMANAGER_ARGS:-" --config-file $OCTAVIA_CONF"}
|
||||
|
||||
OCTAVIA_TEMPEST=${OCTAVIA_TEMPEST:-"disabled"}
|
||||
|
||||
OCTAVIA_API="o-api"
|
||||
OCTAVIA_CONSUMER="o-cw"
|
||||
OCTAVIA_HOUSEKEEPER="o-hk"
|
||||
OCTAVIA_HEALTHMANAGER="o-hm"
|
||||
|
||||
Q_SVC=${Q_SVC:-"q-svc"}
|
||||
LBAAS_V2=${LBAAS_V2:-"q-lbaasv2"}
|
|
@ -1,4 +1,3 @@
|
|||
argparse
|
||||
Babel>=1.3
|
||||
dib-utils
|
||||
PyYAML
|
||||
|
|
Loading…
Reference in New Issue