Merge "Remove support for nova-volume"

This commit is contained in:
Jenkins 2012-11-14 21:58:47 +00:00 committed by Gerrit Code Review
commit 7a51891cb4
10 changed files with 12 additions and 190 deletions

View File

@ -41,9 +41,9 @@ fi
# Import exercise configuration # Import exercise configuration
source $TOP_DIR/exerciserc source $TOP_DIR/exerciserc
# If cinder or n-vol are not enabled we exit with exitcode 55 so that # If cinder is not enabled we exit with exitcode 55 so that
# the exercise is skipped # the exercise is skipped
is_service_enabled cinder n-vol || exit 55 is_service_enabled cinder || exit 55
# Boot this image, use first AMI image if unset # Boot this image, use first AMI image if unset
DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami} DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami}

View File

@ -79,7 +79,7 @@ fi
# Volumes # Volumes
# ------- # -------
if [[ "$ENABLED_SERVICES" =~ "n-vol" || "$ENABLED_SERVICES" =~ "c-vol" ]]; then if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2` VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2`
die_if_not_set VOLUME_ZONE "Failure to find zone for volume" die_if_not_set VOLUME_ZONE "Failure to find zone for volume"

View File

@ -9,7 +9,7 @@ echo "Begin DevStack Exercise: $0"
echo "*********************************************************************" echo "*********************************************************************"
# This script exits on an error so that errors don't compound and you see # This script exits on an error so that errors don't compound and you see
# only the first error that occured. # only the first error that occurred.
set -o errexit set -o errexit
# Print the commands being run so that we can see the command that triggers # Print the commands being run so that we can see the command that triggers
@ -39,9 +39,9 @@ fi
# Import exercise configuration # Import exercise configuration
source $TOP_DIR/exerciserc source $TOP_DIR/exerciserc
# If cinder or n-vol are not enabled we exit with exitcode 55 which mean # If cinder is not enabled we exit with exitcode 55 which mean
# exercise is skipped. # exercise is skipped.
is_service_enabled cinder n-vol || exit 55 is_service_enabled cinder || exit 55
# Instance type to create # Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -140,22 +140,6 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
--role_id $RESELLER_ROLE --role_id $RESELLER_ROLE
fi fi
# Volume
if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
VOLUME_SERVICE=$(get_id keystone service-create \
--name=volume \
--type=volume \
--description="Volume Service")
keystone endpoint-create \
--region RegionOne \
--service_id $VOLUME_SERVICE \
--publicurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
--adminurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s" \
--internalurl "http://$SERVICE_HOST:8776/v1/\$(tenant_id)s"
fi
fi
# Heat # Heat
if [[ "$ENABLED_SERVICES" =~ "heat" ]]; then if [[ "$ENABLED_SERVICES" =~ "heat" ]]; then
HEAT_USER=$(get_id keystone user-create --name=heat \ HEAT_USER=$(get_id keystone user-create --name=heat \

View File

@ -462,7 +462,7 @@ function _cleanup_service_list () {
# ``ENABLED_SERVICES`` list, if they are not already present. # ``ENABLED_SERVICES`` list, if they are not already present.
# #
# For example: # For example:
# enable_service n-vol # enable_service qpid
# #
# This function does not know about the special cases # This function does not know about the special cases
# for nova, glance, and quantum built into is_service_enabled(). # for nova, glance, and quantum built into is_service_enabled().
@ -484,7 +484,7 @@ function enable_service() {
# ``ENABLED_SERVICES`` list, if they are present. # ``ENABLED_SERVICES`` list, if they are present.
# #
# For example: # For example:
# disable_service n-vol # disable_service rabbit
# #
# This function does not know about the special cases # This function does not know about the special cases
# for nova, glance, and quantum built into is_service_enabled(). # for nova, glance, and quantum built into is_service_enabled().
@ -513,8 +513,8 @@ function disable_all_services() {
# Remove all services starting with '-'. For example, to install all default # Remove all services starting with '-'. For example, to install all default
# services except nova-volume (n-vol) set in ``localrc``: # services except rabbit (rabbit) set in ``localrc``:
# ENABLED_SERVICES+=",-n-vol" # ENABLED_SERVICES+=",-rabbit"
# Uses global ``ENABLED_SERVICES`` # Uses global ``ENABLED_SERVICES``
# disable_negated_services # disable_negated_services
function disable_negated_services() { function disable_negated_services() {

126
lib/n-vol
View File

@ -1,126 +0,0 @@
# lib/n-vol
# Install and start Nova volume service
# Dependencies:
# - functions
# - DATA_DIR must be defined
# - KEYSTONE_AUTH_* must be defined
# - NOVA_DIR, NOVA_BIN_DIR, NOVA_STATE_PATH must be defined
# SERVICE_{TENANT_NAME|PASSWORD} must be defined
# _configure_tgt_for_config_d() from lib/cinder
# stack.sh
# ---------
# install_nvol
# configure_nvol
# init_nvol
# start_nvol
# stop_nvol
# cleanup_nvol
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# 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_nvol() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_nvol() {
# kill instances (nova)
# delete image files (glance)
# This function intentionally left blank
:
}
# configure_nvol() - Set config files, create data dirs, etc
function configure_nvol() {
# sudo python setup.py deploy
# iniset $XXX_CONF ...
# This function intentionally left blank
:
}
# init_nvol() - Initialize databases, etc.
function init_nvol() {
# 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 5G 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}
# 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
mkdir -p $NOVA_STATE_PATH/volumes
if sudo vgs $VOLUME_GROUP; then
if [[ "$os_PACKAGE" = "rpm" ]]; then
# RPM doesn't start the service
start_service tgtd
fi
# Remove nova 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
}
# install_nvol() - Collect source and prepare
function install_nvol() {
# git clone xxx
# Install is handled when installing Nova
:
}
# start_nvol() - Start running processes, including screen
function start_nvol() {
# Setup the tgt configuration file
if [[ ! -f /etc/tgt/conf.d/nova.conf ]]; then
_configure_tgt_for_config_d
sudo mkdir -p /etc/tgt/conf.d
echo "include $NOVA_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/nova.conf
fi
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
restart_service tgtd
fi
screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume"
}
# stop_nvol() - Stop running processes
function stop_nvol() {
# Kill the nova volume screen window
screen -S $SCREEN_NAME -p n-vol -X kill
stop_service tgt
}
# Restore xtrace
$XTRACE

View File

@ -312,15 +312,6 @@ function create_nova_conf() {
if is_service_enabled n-api; then if is_service_enabled n-api; then
add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS" add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
fi fi
if is_service_enabled n-vol; then
NOVA_ENABLED_APIS="${NOVA_ENABLED_APIS},osapi_volume"
iniset $NOVA_CONF DEFAULT enabled_apis $NOVA_ENABLED_APIS
add_nova_opt "volume_api_class=nova.volume.api.API"
add_nova_opt "volume_group=$VOLUME_GROUP"
add_nova_opt "volume_name_template=${VOLUME_NAME_PREFIX}%s"
# oneiric no longer supports ietadm
add_nova_opt "iscsi_helper=tgtadm"
fi
if is_service_enabled cinder; then if is_service_enabled cinder; then
add_nova_opt "volume_api_class=nova.volume.cinder.API" add_nova_opt "volume_api_class=nova.volume.cinder.API"
fi fi

View File

@ -93,7 +93,7 @@ DEST=${DEST:-/opt/stack}
# ============ # ============
# Remove services which were negated in ENABLED_SERVICES # Remove services which were negated in ENABLED_SERVICES
# using the "-" prefix (e.g., "-n-vol") instead of # using the "-" prefix (e.g., "-rabbit") instead of
# calling disable_service(). # calling disable_service().
disable_negated_services disable_negated_services
@ -154,12 +154,6 @@ elif [ "$rpc_backend_cnt" == 0 ]; then
fi fi
unset rpc_backend_cnt unset rpc_backend_cnt
# 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
# Set up logging level # Set up logging level
VERBOSE=$(trueorfalse True $VERBOSE) VERBOSE=$(trueorfalse True $VERBOSE)
@ -310,7 +304,6 @@ source $TOP_DIR/lib/keystone
source $TOP_DIR/lib/glance source $TOP_DIR/lib/glance
source $TOP_DIR/lib/nova source $TOP_DIR/lib/nova
source $TOP_DIR/lib/cinder source $TOP_DIR/lib/cinder
source $TOP_DIR/lib/n-vol
source $TOP_DIR/lib/ceilometer source $TOP_DIR/lib/ceilometer
source $TOP_DIR/lib/heat source $TOP_DIR/lib/heat
source $TOP_DIR/lib/quantum source $TOP_DIR/lib/quantum
@ -1760,9 +1753,6 @@ fi
if is_service_enabled cinder; then if is_service_enabled cinder; then
echo_summary "Configuring Cinder" echo_summary "Configuring Cinder"
init_cinder init_cinder
elif is_service_enabled n-vol; then
echo_summary "Configuring Nova volumes"
init_nvol
fi fi
if is_service_enabled nova; then if is_service_enabled nova; then
@ -1962,10 +1952,6 @@ if is_service_enabled nova; then
echo_summary "Starting Nova" echo_summary "Starting Nova"
start_nova start_nova
fi fi
if is_service_enabled n-vol; then
echo_summary "Starting Nova volumes"
start_nvol
fi
if is_service_enabled cinder; then if is_service_enabled cinder; then
echo_summary "Starting Cinder" echo_summary "Starting Cinder"
start_cinder start_cinder

View File

@ -11,10 +11,6 @@ DEST=/opt/stack
# ``disable_service`` functions in ``localrc``. # ``disable_service`` functions in ``localrc``.
# For example, to enable Swift add this to ``localrc``: # For example, to enable Swift add this to ``localrc``:
# enable_service swift # enable_service swift
#
# And to disable Cinder and use Nova Volumes instead:
# disable_service c-api c-sch c-vol cinder
# enable_service n-vol
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit
# Set the default Nova APIs to enable # Set the default Nova APIs to enable

View File

@ -26,7 +26,6 @@ DATA_DIR=${DATA_DIR:-${DEST}/data}
# Get project function libraries # Get project function libraries
source $TOP_DIR/lib/cinder source $TOP_DIR/lib/cinder
source $TOP_DIR/lib/n-vol
# Determine what system we are running on. This provides ``os_VENDOR``, # Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@ -58,11 +57,7 @@ fi
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/* SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
# Get the iSCSI volumes # Get the iSCSI volumes
if is_service_enabled cinder n-vol; then if is_service_enabled cinder; then
if is_service_enabled n-vol; then
SCSI_PERSIST_DIR=$NOVA_STATE_PATH/volumes/*
fi
TARGETS=$(sudo tgtadm --op show --mode target) TARGETS=$(sudo tgtadm --op show --mode target)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
# If tgt driver isn't running this won't work obviously # If tgt driver isn't running this won't work obviously
@ -88,10 +83,6 @@ if is_service_enabled cinder n-vol; then
sudo rm -rf $CINDER_STATE_PATH/volumes/* sudo rm -rf $CINDER_STATE_PATH/volumes/*
fi fi
if is_service_enabled n-vol; then
sudo rm -rf $NOVA_STATE_PATH/volumes/*
fi
if [[ "$os_PACKAGE" = "deb" ]]; then if [[ "$os_PACKAGE" = "deb" ]]; then
stop_service tgt stop_service tgt
else else