Merge "Support sql service catalog backend"
diff --git a/.gitignore b/.gitignore
index c8d2560..83c5419 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
proto
*~
+.*.sw[nop]
*.log
src
localrc
diff --git a/AUTHORS b/AUTHORS
index ff05f82..b5f972f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -5,6 +5,7 @@
Armando Migliaccio <armando.migliaccio@eu.citrix.com>
Brad Hall <brad@nicira.com>
Chmouel Boudjnah <chmouel@chmouel.com>
+Dan Prince <dprince@redhat.com>
Dean Troyer <dtroyer@gmail.com>
Devin Carlen <devin.carlen@gmail.com>
Eddie Hebert <edhebert@gmail.com>
diff --git a/exerciserc b/exerciserc
index b41714d..82c74b7 100644
--- a/exerciserc
+++ b/exerciserc
@@ -20,3 +20,9 @@
# Max time to wait for a vm to terminate
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}
+
+# Max time to wait for a euca-volume command to propogate
+export VOLUME_TIMEOUT=${VOLUME_TIMEOUT:-30}
+
+# Max time to wait for a euca-delete command to propogate
+export VOLUME_DELETE_TIMEOUT=${SNAPSHOT_DELETE_TIMEOUT:-60}
diff --git a/exercises/euca.sh b/exercises/euca.sh
index 76e5202..4a538c6 100755
--- a/exercises/euca.sh
+++ b/exercises/euca.sh
@@ -24,6 +24,9 @@
# Keep track of the current directory
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
+VOLUME_ZONE=cinder
+VOLUME_SIZE=1
+ATTACH_DEVICE=/dev/vdc
# Import common functions
source $TOP_DIR/functions
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 6749558..0f25355 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -33,6 +33,10 @@
# Import exercise configuration
source $TOP_DIR/exerciserc
+# If cinder or n-vol are not enabled we exit with exitcode 55 which mean
+# exercise is skipped.
+is_service_enabled cinder n-vol || exit 55
+
# Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}
diff --git a/files/apache-horizon.template b/files/apache-horizon.template
index e54f16c..fb98471 100644
--- a/files/apache-horizon.template
+++ b/files/apache-horizon.template
@@ -1,6 +1,7 @@
<VirtualHost *:80>
WSGIScriptAlias / %HORIZON_DIR%/openstack_dashboard/wsgi/django.wsgi
WSGIDaemonProcess horizon user=%USER% group=%GROUP% processes=3 threads=10 home=%HORIZON_DIR%
+ WSGIApplicationGroup %{GLOBAL}
SetEnv APACHE_RUN_USER %USER%
SetEnv APACHE_RUN_GROUP %GROUP%
diff --git a/files/apts/cinder b/files/apts/cinder
new file mode 100644
index 0000000..5db06ea
--- /dev/null
+++ b/files/apts/cinder
@@ -0,0 +1,2 @@
+tgt
+lvm2
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 1f05f10..7886072 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -9,6 +9,7 @@
# service nova admin, [ResellerAdmin (swift only)]
# service quantum admin # if enabled
# service swift admin # if enabled
+# service cinder admin # if enabled
# demo admin admin
# demo demo Member, anotherrole
# invisible_to_admin demo Member
@@ -273,3 +274,13 @@
--user_id $ALT_DEMO_USER \
--role_id $MEMBER_ROLE
fi
+
+if [[ "$ENABLED_SERVICES" =~ "cinder" ]]; then
+ CINDER_USER=$(get_id keystone user-create --name=cinder \
+ --pass="$SERVICE_PASSWORD" \
+ --tenant_id $SERVICE_TENANT \
+ --email=cinder@example.com)
+ keystone user-role-add --tenant_id $SERVICE_TENANT \
+ --user_id $CINDER_USER \
+ --role_id $ADMIN_ROLE
+fi
diff --git a/files/rpms/cinder b/files/rpms/cinder
new file mode 100644
index 0000000..df861aa
--- /dev/null
+++ b/files/rpms/cinder
@@ -0,0 +1,2 @@
+lvm2
+scsi-target-utils
diff --git a/files/rpms/glance b/files/rpms/glance
index e38f239..eff6c2c 100644
--- a/files/rpms/glance
+++ b/files/rpms/glance
@@ -1,5 +1,6 @@
libxml2-devel
python-argparse
+python-devel
python-eventlet
python-greenlet
python-paste-deploy
diff --git a/functions b/functions
index 32427a4..a3e9537 100644
--- a/functions
+++ b/functions
@@ -142,6 +142,8 @@
# be owned by the installation user, we create the directory and change the
# ownership to the proper user.
# Set global RECLONE=yes to simulate a clone when dest-dir exists
+# Set global ERROR_ON_CLONE=True to abort execution with an error if the git repo
+# does not exist (default is False, meaning the repo will be cloned).
# git_clone remote dest-dir branch
function git_clone {
[[ "$OFFLINE" = "True" ]] && return
@@ -153,6 +155,7 @@
if echo $GIT_BRANCH | egrep -q "^refs"; then
# If our branch name is a gerrit style refs/changes/...
if [[ ! -d $GIT_DEST ]]; then
+ [[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
git clone $GIT_REMOTE $GIT_DEST
fi
cd $GIT_DEST
@@ -160,6 +163,7 @@
else
# do a full clone only if the directory doesn't exist
if [[ ! -d $GIT_DEST ]]; then
+ [[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
git clone $GIT_REMOTE $GIT_DEST
cd $GIT_DEST
# This checkout syntax works for both branches and tags
@@ -253,6 +257,7 @@
for service in ${services}; do
[[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0
[[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0
+ [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0
[[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0
[[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0
done
diff --git a/lib/cinder b/lib/cinder
new file mode 100644
index 0000000..f0715a4
--- /dev/null
+++ b/lib/cinder
@@ -0,0 +1,154 @@
+# lib/cinder
+# Install and start Cinder volume service
+
+# Dependencies:
+# - functions
+# - KEYSTONE_AUTH_* must be defined
+# SERVICE_{TENANT_NAME|PASSWORD} must be defined
+
+# stack.sh
+# ---------
+# install_XXX
+# configure_XXX
+# init_XXX
+# start_XXX
+# stop_XXX
+# cleanup_XXX
+
+# Print the commands being run so that we can see the command that triggers
+# an error. It is also useful for following along as the install occurs.
+set -o xtrace
+
+
+# Defaults
+# --------
+
+# set up default directories
+CINDER_DIR=$DEST/cinder
+CINDERCLIENT_DIR=$DEST/python-cinderclient
+CINDER_CONF_DIR=/etc/cinder
+CINDER_CONF=$CINDER_CONF_DIR/cinder.conf
+
+# Name of the lvm volume group to use/create for iscsi volumes
+VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
+VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
+
+# cleanup_cinder() - Remove residual data files, anything left over from previous
+# runs that a clean run would need to clean up
+function cleanup_cinder() {
+ # This function intentionally left blank
+ :
+}
+
+# configure_cinder() - Set config files, create data dirs, etc
+function configure_cinder() {
+ setup_develop $CINDER_DIR
+ setup_develop $CINDERCLIENT_DIR
+
+ if [[ ! -d $CINDER_CONF_DIR ]]; then
+ sudo mkdir -p $CINDER_CONF_DIR
+ fi
+ sudo chown `whoami` $CINDER_CONF_DIR
+
+ cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
+
+ CINDER_API_PASTE_INI=$CINDER_CONF_DIR/api-paste.ini
+ cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
+ iniset $CINDER_API_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
+ iniset $CINDER_API_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
+ iniset $CINDER_API_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
+ iniset $CINDER_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
+ iniset $CINDER_API_PASTE_INI filter:authtoken admin_user cinder
+ iniset $CINDER_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
+
+ cp $CINDER_DIR/etc/cinder/cinder.conf.sample $CINDER_CONF
+ iniset $CINDER_CONF DEFAULT auth_strategy keystone
+ iniset $CINDER_CONF DEFAULT verbose True
+ iniset $CINDER_CONF DEFAULT volume_group $VOLUME_GROUP
+ iniset $CINDER_CONF DEFAULT volume_name_template ${VOLUME_NAME_PREFIX}%s
+ iniset $CINDER_CONF DEFAULT iscsi_helper tgtadm
+ iniset $CINDER_CONF DEFAULT sql_connection $BASE_SQL_CONN/cinder?charset=utf8
+ iniset $CINDER_CONF DEFAULT rabbit_host $RABBIT_HOST
+ iniset $CINDER_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
+ iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI
+}
+
+# init_cinder() - Initialize database and volume group
+function init_cinder() {
+ # Force nova volumes off
+ NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/osapi_volume,//")
+
+ if is_service_enabled mysql; then
+ # (re)create cinder database
+ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS cinder;'
+ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE cinder;'
+
+ # (re)create cinder database
+ $CINDER_DIR/bin/cinder-manage db sync
+ fi
+
+ if is_service_enabled c-vol; then
+ # Configure a default volume group called '`stack-volumes`' for the volume
+ # service if it does not yet exist. If you don't wish to use a file backed
+ # volume group, create your own volume group called ``stack-volumes`` before
+ # invoking ``stack.sh``.
+ #
+ # By default, the backing file is 2G in size, and is stored in ``/opt/stack/data``.
+
+ if ! sudo vgs $VOLUME_GROUP; then
+ VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
+ VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-2052M}
+ # Only create if the file doesn't already exists
+ [[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
+ DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
+ # Only create if the loopback device doesn't contain $VOLUME_GROUP
+ if ! sudo vgs $VOLUME_GROUP; then sudo vgcreate $VOLUME_GROUP $DEV; fi
+ fi
+
+ if sudo vgs $VOLUME_GROUP; then
+ # Remove iscsi targets
+ sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
+ # Clean out existing volumes
+ for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do
+ # VOLUME_NAME_PREFIX prefixes the LVs we want
+ if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then
+ sudo lvremove -f $VOLUME_GROUP/$lv
+ fi
+ done
+ fi
+ fi
+}
+
+# install_cinder() - Collect source and prepare
+function install_cinder() {
+ git_clone $CINDER_REPO $CINDER_DIR $CINDER_BRANCH
+ git_clone $CINDERCLIENT_REPO $CINDERCLIENT_DIR $CINDERCLIENT_BRANCH
+}
+
+# start_cinder() - Start running processes, including screen
+function start_cinder() {
+ if is_service_enabled c-vol; then
+ if [[ "$os_PACKAGE" = "deb" ]]; then
+ # tgt in oneiric doesn't restart properly if tgtd isn't running
+ # do it in two steps
+ sudo stop tgt || true
+ sudo start tgt
+ else
+ # bypass redirection to systemctl during restart
+ sudo /sbin/service --skip-redirect tgtd restart
+ fi
+ fi
+
+ screen_it c-api "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-api --config-file $CINDER_CONF"
+ screen_it c-vol "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-volume --config-file $CINDER_CONF"
+ screen_it c-sch "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-scheduler --config-file $CINDER_CONF"
+}
+
+# stop_cinder() - Stop running processes (non-screen)
+function stop_cinder() {
+ # FIXME(dtroyer): stop only the cinder screen window?
+
+ if is_service_enabled c-vol; then
+ stop_service tgt
+ fi
+}
diff --git a/stack.sh b/stack.sh
index f3c0537..4523c2c 100755
--- a/stack.sh
+++ b/stack.sh
@@ -112,6 +112,13 @@
NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
fi
+# ``stack.sh`` keeps function libraries here
+# Make sure ``$TOP_DIR/lib`` directory is present
+if [ ! -d $TOP_DIR/lib ]; then
+ echo "ERROR: missing devstack/lib - did you grab more than just stack.sh?"
+ exit 1
+fi
+
# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external
# files, along with config templates and other useful files. You can find these
# in the ``files`` directory (next to this script). We will reference this
@@ -130,6 +137,12 @@
exit 1
fi
+# Make sure we only have one volume service enabled.
+if is_service_enabled cinder && is_service_enabled n-vol; then
+ echo "ERROR: n-vol and cinder must not be enabled at the same time"
+ exit 1
+fi
+
# OpenStack is designed to be run as a regular user (Horizon will fail to run
# as root, since apache refused to startup serve content from root user). If
# ``stack.sh`` is run as **root**, it automatically creates a **stack** user with
@@ -201,6 +214,24 @@
# prerequisites and initialize ``$DEST``.
OFFLINE=`trueorfalse False $OFFLINE`
+# Set True to configure ``stack.sh`` to exit with an error code if it is asked
+# to clone any git repositories. If devstack is used in a testing environment,
+# this may be used to ensure that the correct code is being tested.
+ERROR_ON_CLONE=`trueorfalse False $ERROR_ON_CLONE`
+
+# Destination path for service data
+DATA_DIR=${DATA_DIR:-${DEST}/data}
+sudo mkdir -p $DATA_DIR
+sudo chown `whoami` $DATA_DIR
+
+
+# Projects
+# --------
+
+# Get project function libraries
+source $TOP_DIR/lib/cinder
+
+
# Set the destination directories for openstack projects
NOVA_DIR=$DEST/nova
HORIZON_DIR=$DEST/horizon
@@ -234,7 +265,7 @@
M_MAC_RANGE=${M_MAC_RANGE:-FE-EE-DD-00-00-00/24}
# Name of the lvm volume group to use/create for iscsi volumes
-VOLUME_GROUP=${VOLUME_GROUP:-nova-volumes}
+VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-}
@@ -607,6 +638,10 @@
if [[ ! $file_to_parse =~ glance ]]; then
file_to_parse="${file_to_parse} glance"
fi
+ elif [[ $service == c-* ]]; then
+ if [[ ! $file_to_parse =~ cinder ]]; then
+ file_to_parse="${file_to_parse} cinder"
+ fi
elif [[ $service == n-* ]]; then
if [[ ! $file_to_parse =~ nova ]]; then
file_to_parse="${file_to_parse} nova"
@@ -704,10 +739,12 @@
# melange
git_clone $MELANGE_REPO $MELANGE_DIR $MELANGE_BRANCH
fi
-
if is_service_enabled melange; then
git_clone $MELANGECLIENT_REPO $MELANGECLIENT_DIR $MELANGECLIENT_BRANCH
fi
+if is_service_enabled cinder; then
+ install_cinder
+fi
# Initialization
@@ -729,6 +766,10 @@
if is_service_enabled g-api n-api; then
setup_develop $GLANCE_DIR
fi
+
+# Do this _after_ glance is installed to override the old binary
+setup_develop $GLANCECLIENT_DIR
+
setup_develop $NOVA_DIR
if is_service_enabled horizon; then
setup_develop $HORIZON_DIR
@@ -743,9 +784,9 @@
if is_service_enabled melange; then
setup_develop $MELANGECLIENT_DIR
fi
-
-# Do this _after_ glance is installed to override the old binary
-setup_develop $GLANCECLIENT_DIR
+if is_service_enabled cinder; then
+ configure_cinder
+fi
# Syslog
@@ -1033,6 +1074,9 @@
GLANCE_POLICY_JSON=$GLANCE_CONF_DIR/policy.json
cp $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
+
+ $GLANCE_DIR/bin/glance-manage db_sync
+
fi
# Quantum (for controller or agent nodes)
@@ -1078,23 +1122,28 @@
echo "OVS 1.4+ is required for tunneling between multiple hosts."
exit 1
fi
- sudo sed -i -e "s/.*enable-tunneling = .*$/enable-tunneling = $OVS_ENABLE_TUNNELING/g" /$Q_PLUGIN_CONF_FILE
+ sudo sed -i -e "s/.*enable_tunneling = .*$/enable_tunneling = $OVS_ENABLE_TUNNELING/g" /$Q_PLUGIN_CONF_FILE
fi
fi
# Quantum service (for controller node)
if is_service_enabled q-svc; then
- Q_PLUGIN_INI_FILE=/etc/quantum/plugins.ini
Q_CONF_FILE=/etc/quantum/quantum.conf
- # must remove this file from existing location, otherwise Quantum will prefer it
- if [[ -e $QUANTUM_DIR/etc/plugins.ini ]]; then
- sudo mv $QUANTUM_DIR/etc/plugins.ini $Q_PLUGIN_INI_FILE
- fi
+ Q_API_PASTE_FILE=/etc/quantum/api-paste.ini
+ Q_POLICY_FILE=/etc/quantum/policy.json
if [[ -e $QUANTUM_DIR/etc/quantum.conf ]]; then
sudo mv $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
fi
+ if [[ -e $QUANTUM_DIR/etc/api-paste.ini ]]; then
+ sudo mv $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
+ fi
+
+ if [[ -e $QUANTUM_DIR/etc/policy.json ]]; then
+ sudo mv $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE
+ fi
+
if is_service_enabled mysql; then
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS $Q_DB_NAME;"
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $Q_DB_NAME CHARACTER SET utf8;"
@@ -1102,9 +1151,10 @@
echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
exit 1
fi
- sudo sed -i -e "s/^provider =.*$/provider = $Q_PLUGIN_CLASS/g" $Q_PLUGIN_INI_FILE
- screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server $Q_CONF_FILE"
+ # Update either configuration file with plugin
+ sudo sed -i -e "s/^core_plugin =.*$/core_plugin = $Q_PLUGIN_CLASS/g" $Q_CONF_FILE
+ screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $Q_CONF_FILE"
fi
# Quantum agent (for compute nodes)
@@ -1128,7 +1178,7 @@
sudo ovs-vsctl --no-wait -- --if-exists del-br $OVS_BRIDGE
sudo ovs-vsctl --no-wait add-br $OVS_BRIDGE
sudo ovs-vsctl --no-wait br-set-external-id $OVS_BRIDGE bridge-id br-int
- sudo sed -i -e "s/.*local-ip = .*/local-ip = $HOST_IP/g" /$Q_PLUGIN_CONF_FILE
+ sudo sed -i -e "s/.*local_ip = .*/local_ip = $HOST_IP/g" /$Q_PLUGIN_CONF_FILE
AGENT_BINARY=$QUANTUM_DIR/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
# Start up the quantum <-> linuxbridge agent
@@ -1178,7 +1228,7 @@
cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
-# If Nova ships the new rootwrap.d config files, deploy them
+# If Nova ships the new rootwrap filters files, deploy them
# (owned by root) and add a parameter to $NOVA_ROOTWRAP
ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
@@ -1186,11 +1236,18 @@
if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then
sudo rm -rf $NOVA_CONF_DIR/rootwrap.d
fi
+ # Deploy filters to /etc/nova/rootwrap.d
sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d
- sudo cp $NOVA_DIR/etc/nova/rootwrap.d/* $NOVA_CONF_DIR/rootwrap.d
+ sudo cp $NOVA_DIR/etc/nova/rootwrap.d/*.filters $NOVA_CONF_DIR/rootwrap.d
sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d
sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/*
- NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.d"
+ # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d
+ sudo cp $NOVA_DIR/etc/nova/rootwrap.conf $NOVA_CONF_DIR/
+ sudo sed -e "s:^filters_path=.*$:filters_path=$NOVA_CONF_DIR/rootwrap.d:" -i $NOVA_CONF_DIR/rootwrap.conf
+ sudo chown root:root $NOVA_CONF_DIR/rootwrap.conf
+ sudo chmod 0644 $NOVA_CONF_DIR/rootwrap.conf
+ # Specify rootwrap.conf as first parameter to nova-rootwrap
+ NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.conf"
ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP *"
fi
@@ -1383,6 +1440,9 @@
# Install memcached for swift.
install_package memcached
+ # We make sure to kill all swift processes first
+ pkill -f -9 swift-
+
# We first do a bit of setup by creating the directories and
# changing the permissions so we can run it as our user.
@@ -1513,7 +1573,7 @@
admin_password = ${SERVICE_PASSWORD}
[filter:swift3]
-use = egg:swift3#middleware
+use = egg:swift3#swift3
EOF
cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
@@ -1627,17 +1687,18 @@
# Volume Service
# --------------
-if is_service_enabled n-vol; then
- #
- # Configure a default volume group called 'nova-volumes' for the nova-volume
+if is_service_enabled cinder; then
+ init_cinder
+elif is_service_enabled n-vol; then
+ # Configure a default volume group called '`stack-volumes`' for the volume
# service if it does not yet exist. If you don't wish to use a file backed
- # volume group, create your own volume group called 'nova-volumes' before
- # invoking stack.sh.
+ # volume group, create your own volume group called ``stack-volumes`` before
+ # invoking ``stack.sh``.
#
- # By default, the backing file is 2G in size, and is stored in /opt/stack.
+ # By default, the backing file is 2G in size, and is stored in ``/opt/stack/data``.
if ! sudo vgs $VOLUME_GROUP; then
- VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DEST/nova-volumes-backing-file}
+ VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-2052M}
# Only create if the file doesn't already exists
[[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
@@ -1785,6 +1846,10 @@
add_nova_opt "logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
+# If cinder is enabled, use the cinder volume driver
+if is_service_enabled cinder; then
+ add_nova_opt "volume_api_class=nova.volume.cinder.API"
+fi
# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS
if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then
@@ -1966,6 +2031,7 @@
# launch the nova-api and wait for it to answer before continuing
if is_service_enabled n-api; then
+ add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
echo "Waiting for nova-api to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
@@ -2001,6 +2067,9 @@
screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF --web ."
screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF"
screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth"
+if is_service_enabled cinder; then
+ start_cinder
+fi
screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log"
screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
diff --git a/stackrc b/stackrc
index 3387d43..cc07906 100644
--- a/stackrc
+++ b/stackrc
@@ -9,6 +9,17 @@
# ENABLED_SERVICES="$ENABLED_SERVICES,swift"
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit
+# Set the default Nova APIs to enable
+NOVA_ENABLED_APIS=ec2,osapi_compute,osapi_volume,metadata
+
+# volume service
+CINDER_REPO=https://github.com/openstack/cinder
+CINDER_BRANCH=master
+
+# volume client
+CINDERCLIENT_REPO=https://github.com/openstack/python-cinderclient
+CINDERCLIENT_BRANCH=master
+
# compute service
NOVA_REPO=https://github.com/openstack/nova.git
NOVA_BRANCH=master
diff --git a/tests/functions.sh b/tests/functions.sh
index e7fbe0c..e436ed9 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -141,3 +141,5 @@
else
echo "inicomment failed: $VAL"
fi
+
+rm test.ini
diff --git a/unstack.sh b/unstack.sh
index 341270d..879f842 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -44,7 +44,7 @@
fi
# Get the iSCSI volumes
-if is_service_enabled n-vol; then
+if is_service_enabled cinder n-vol; then
TARGETS=$(sudo tgtadm --op show --mode target)
if [[ -n "$TARGETS" ]]; then
# FIXME(dtroyer): this could very well require more here to