e263c82e |
#!/bin/bash
# |
67787e6b |
# lib/cinder |
6d04fd7b |
# Install and start **Cinder** volume service |
67787e6b |
# Dependencies: |
6a5aa7c6 |
# |
67787e6b |
# - functions |
91b8d13e |
# - DEST, DATA_DIR, STACK_USER must be defined |
6a5aa7c6 |
# - SERVICE_{TENANT_NAME|PASSWORD} must be defined
# - ``KEYSTONE_TOKEN_FORMAT`` must be defined |
67787e6b |
# stack.sh
# --------- |
6a5aa7c6 |
# - install_cinder
# - configure_cinder
# - init_cinder
# - start_cinder
# - stop_cinder
# - cleanup_cinder |
67787e6b |
|
7903b795 |
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace |
67787e6b |
# Defaults
# --------
|
b2fdafea |
# set up default driver
CINDER_DRIVER=${CINDER_DRIVER:-default} |
d0860cc2 |
CINDER_PLUGINS=$TOP_DIR/lib/cinder_plugins |
09718335 |
CINDER_BACKENDS=$TOP_DIR/lib/cinder_backends |
d0860cc2 |
# grab plugin config if specified via cinder_driver
if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
source $CINDER_PLUGINS/$CINDER_DRIVER
fi |
b2fdafea |
|
67787e6b |
# set up default directories |
e08ab104 |
GITDIR["python-cinderclient"]=$DEST/python-cinderclient |
5cb19069 |
|
67787e6b |
CINDER_DIR=$DEST/cinder |
50ac7921 |
CINDER_STATE_PATH=${CINDER_STATE_PATH:=$DATA_DIR/cinder} |
671c16e6 |
CINDER_AUTH_CACHE_DIR=${CINDER_AUTH_CACHE_DIR:-/var/cache/cinder}
|
50ac7921 |
CINDER_CONF_DIR=/etc/cinder
CINDER_CONF=$CINDER_CONF_DIR/cinder.conf |
671c16e6 |
CINDER_API_PASTE_INI=$CINDER_CONF_DIR/api-paste.ini |
50ac7921 |
|
560346b5 |
# Public facing bits |
18d4778c |
if is_ssl_enabled_service "cinder" || is_service_enabled tls-proxy; then
CINDER_SERVICE_PROTOCOL="https"
fi |
560346b5 |
CINDER_SERVICE_HOST=${CINDER_SERVICE_HOST:-$SERVICE_HOST}
CINDER_SERVICE_PORT=${CINDER_SERVICE_PORT:-8776}
CINDER_SERVICE_PORT_INT=${CINDER_SERVICE_PORT_INT:-18776}
CINDER_SERVICE_PROTOCOL=${CINDER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
50ac7921 |
# Support entry points installation of console scripts
if [[ -d $CINDER_DIR/bin ]]; then |
9fbeeddc |
CINDER_BIN_DIR=$CINDER_DIR/bin
else |
4196d556 |
CINDER_BIN_DIR=$(get_python_exec_prefix) |
9fbeeddc |
fi |
67787e6b |
|
09718335 |
# Maintain this here for backward-compatibility with the old configuration
# DEPRECATED: Use CINDER_ENABLED_BACKENDS instead |
dda2b7af |
# Support for multi lvm backend configuration (default is no support) |
53753293 |
CINDER_MULTI_LVM_BACKEND=$(trueorfalse False CINDER_MULTI_LVM_BACKEND) |
dda2b7af |
|
09718335 |
# Default backends
# The backend format is type:name where type is one of the supported backend
# types (lvm, nfs, etc) and name is the identifier used in the Cinder
# configuration and for the volume type name. Multiple backends are
# comma-separated.
if [[ $CINDER_MULTI_LVM_BACKEND == "False" ]]; then
CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1}
else
CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1,lvm:lvmdriver-2}
fi
|
b7490da9 |
# Should cinder perform secure deletion of volumes?
# Defaults to true, can be set to False to avoid this bug when testing:
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755 |
53753293 |
CINDER_SECURE_DELETE=$(trueorfalse True CINDER_SECURE_DELETE) |
b7490da9 |
|
f35ff72b |
# Cinder reports allocations back to the scheduler on periodic intervals
# it turns out we can get an "out of space" issue when we run tests too
# quickly just because cinder didn't realize we'd freed up resources.
# Make this configurable so that devstack-gate/tempest can set it to
# less than the 60 second default
# https://bugs.launchpad.net/cinder/+bug/1180976
CINDER_PERIODIC_INTERVAL=${CINDER_PERIODIC_INTERVAL:-60}
|
4237f590 |
# Tell Tempest this project is present
TEMPEST_SERVICES+=,cinder
|
cc6b4435 |
|
09718335 |
# Source the enabled backends
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
e8a35acd |
be_type=${be%%:*}
be_name=${be##*:}
if [[ -r $CINDER_BACKENDS/${be_type} ]]; then
source $CINDER_BACKENDS/${be_type} |
09718335 |
fi
done
fi
|
afc1423e |
# Change the default nova_catalog_info and nova_catalog_admin_info values in
# cinder so that the service name cinder is searching for matches that set for
# nova in keystone.
CINDER_NOVA_CATALOG_INFO=${CINDER_NOVA_CATALOG_INFO:-compute:nova:publicURL}
CINDER_NOVA_CATALOG_ADMIN_INFO=${CINDER_NOVA_CATALOG_ADMIN_INFO:-compute:nova:adminURL}
|
09718335 |
|
cc6b4435 |
# Functions
# --------- |
e4fa7213 |
# Test if any Cinder services are enabled
# is_cinder_enabled
function is_cinder_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
return 1
}
|
67787e6b |
# cleanup_cinder() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up |
aee18c74 |
function cleanup_cinder { |
252f2f53 |
# ensure the volume group is cleared up because fails might
# leave dead volumes in the group |
e8a35acd |
local targets=$(sudo tgtadm --op show --mode target) |
252f2f53 |
if [ $? -ne 0 ]; then
# If tgt driver isn't running this won't work obviously
# So check the response and restart if need be
echo "tgtd seems to be in a bad state, restarting..."
if is_ubuntu; then
restart_service tgt
else
restart_service tgtd
fi |
e8a35acd |
targets=$(sudo tgtadm --op show --mode target) |
252f2f53 |
fi
|
e8a35acd |
if [[ -n "$targets" ]]; then
local iqn_list=( $(grep --no-filename -r iqn $SCSI_PERSIST_DIR | sed 's/<target //' | sed 's/>//') ) |
252f2f53 |
for i in "${iqn_list[@]}"; do
echo removing iSCSI target: $i
sudo tgt-admin --delete $i
done
fi
if is_ubuntu; then
stop_service tgt
else
stop_service tgtd
fi
|
09718335 |
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then |
e8a35acd |
local be be_name be_type |
09718335 |
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
e8a35acd |
be_type=${be%%:*}
be_name=${be##*:}
if type cleanup_cinder_backend_${be_type} >/dev/null 2>&1; then
cleanup_cinder_backend_${be_type} ${be_name} |
09718335 |
fi
done |
dda2b7af |
fi |
67787e6b |
}
|
63e17843 |
# configure_cinder_rootwrap() - configure Cinder's rootwrap |
aee18c74 |
function configure_cinder_rootwrap { |
4e823ff4 |
# Set the paths of certain binaries |
e8a35acd |
local cinder_rootwrap=$(get_rootwrap_location cinder) |
4e823ff4 |
|
d5d4974c |
# Deploy new rootwrap filters files (owned by root).
# Wipe any existing rootwrap.d files first
if [[ -d $CINDER_CONF_DIR/rootwrap.d ]]; then
sudo rm -rf $CINDER_CONF_DIR/rootwrap.d |
4e823ff4 |
fi |
d5d4974c |
# Deploy filters to /etc/cinder/rootwrap.d
sudo mkdir -m 755 $CINDER_CONF_DIR/rootwrap.d
sudo cp $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d
sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d
sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/*
# Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d
sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/
sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf
sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf
sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf
# Specify rootwrap.conf as first parameter to rootwrap |
e8a35acd |
ROOTWRAP_CSUDOER_CMD="$cinder_rootwrap $CINDER_CONF_DIR/rootwrap.conf *" |
d5d4974c |
# Set up the rootwrap sudoers for cinder |
e8a35acd |
local tempfile=`mktemp`
echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_CSUDOER_CMD" >$tempfile
chmod 0440 $tempfile
sudo chown root:root $tempfile
sudo mv $tempfile /etc/sudoers.d/cinder-rootwrap |
63e17843 |
}
# configure_cinder() - Set config files, create data dirs, etc |
aee18c74 |
function configure_cinder { |
63e17843 |
if [[ ! -d $CINDER_CONF_DIR ]]; then
sudo mkdir -p $CINDER_CONF_DIR
fi
sudo chown $STACK_USER $CINDER_CONF_DIR
cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
|
cecbd1ff |
rm -f $CINDER_CONF
|
63e17843 |
configure_cinder_rootwrap |
4e823ff4 |
|
67787e6b |
cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI |
82dea7c6 |
inicomment $CINDER_API_PASTE_INI filter:authtoken auth_host
inicomment $CINDER_API_PASTE_INI filter:authtoken auth_port
inicomment $CINDER_API_PASTE_INI filter:authtoken auth_protocol |
bd24a8d0 |
inicomment $CINDER_API_PASTE_INI filter:authtoken cafile |
82dea7c6 |
inicomment $CINDER_API_PASTE_INI filter:authtoken admin_tenant_name
inicomment $CINDER_API_PASTE_INI filter:authtoken admin_user
inicomment $CINDER_API_PASTE_INI filter:authtoken admin_password
inicomment $CINDER_API_PASTE_INI filter:authtoken signing_dir |
bc071bce |
|
0595237e |
configure_auth_token_middleware $CINDER_CONF cinder $CINDER_AUTH_CACHE_DIR |
82dea7c6 |
|
afc1423e |
iniset $CINDER_CONF DEFAULT nova_catalog_info $CINDER_NOVA_CATALOG_INFO
iniset $CINDER_CONF DEFAULT nova_catalog_admin_info $CINDER_NOVA_CATALOG_ADMIN_INFO
|
67787e6b |
iniset $CINDER_CONF DEFAULT auth_strategy keystone |
03997942 |
iniset $CINDER_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
67787e6b |
iniset $CINDER_CONF DEFAULT verbose True |
09718335 |
|
08df29bf |
iniset $CINDER_CONF DEFAULT my_ip "$CINDER_SERVICE_HOST" |
67787e6b |
iniset $CINDER_CONF DEFAULT iscsi_helper tgtadm |
7e79d913 |
iniset $CINDER_CONF DEFAULT sql_connection `database_connection_url cinder` |
67787e6b |
iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI |
a58382ac |
iniset $CINDER_CONF DEFAULT rootwrap_config "$CINDER_CONF_DIR/rootwrap.conf" |
9f22f07a |
iniset $CINDER_CONF DEFAULT osapi_volume_extension cinder.api.contrib.standard_extensions |
50ac7921 |
iniset $CINDER_CONF DEFAULT state_path $CINDER_STATE_PATH |
84783c72 |
iniset $CINDER_CONF DEFAULT lock_path $CINDER_STATE_PATH |
f35ff72b |
iniset $CINDER_CONF DEFAULT periodic_interval $CINDER_PERIODIC_INTERVAL |
f64f43b5 |
# NOTE(thingee): Cinder V1 API is deprecated and defaults to off as of
# Juno. Keep it enabled so we can continue testing while it's still
# supported.
iniset $CINDER_CONF DEFAULT enable_v1_api true |
4e823ff4 |
|
09718335 |
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then |
e8a35acd |
local enabled_backends=""
local default_name=""
local be be_name be_type |
09718335 |
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
e8a35acd |
be_type=${be%%:*}
be_name=${be##*:}
if type configure_cinder_backend_${be_type} >/dev/null 2>&1; then
configure_cinder_backend_${be_type} ${be_name} |
09718335 |
fi |
a25922b9 |
if [[ -z "$default_name" ]]; then
default_name=$be_name |
09718335 |
fi |
e8a35acd |
enabled_backends+=$be_name, |
09718335 |
done
iniset $CINDER_CONF DEFAULT enabled_backends ${enabled_backends%,*} |
6a4aa78f |
if [[ -n "$default_name" ]]; then
iniset $CINDER_CONF DEFAULT default_volume_type ${default_name} |
09718335 |
fi
fi
|
2983474e |
if is_service_enabled swift; then |
7d0a0f7d |
iniset $CINDER_CONF DEFAULT backup_swift_url "$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:8080/v1/AUTH_" |
2983474e |
fi
|
2bfbc779 |
if is_service_enabled ceilometer; then |
dc0938e1 |
iniset $CINDER_CONF DEFAULT notification_driver "messaging" |
2bfbc779 |
fi
|
560346b5 |
if is_service_enabled tls-proxy; then
# Set the service port for a proxy to take the original
iniset $CINDER_CONF DEFAULT osapi_volume_listen_port $CINDER_SERVICE_PORT_INT
fi
|
4d3049e7 |
if [ "$SYSLOG" != "False" ]; then
iniset $CINDER_CONF DEFAULT use_syslog True
fi
|
b0f1c38b |
iniset_rpc_backend cinder $CINDER_CONF DEFAULT |
f71bf192 |
|
213c4168 |
if [[ "$CINDER_SECURE_DELETE" == "False" ]]; then
iniset $CINDER_CONF DEFAULT secure_delete False |
eac9370a |
iniset $CINDER_CONF DEFAULT volume_clear none |
213c4168 |
fi
|
05ae833b |
# Format logging |
1057bffa |
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
05ae833b |
setup_colorized_logging $CINDER_CONF DEFAULT "project_id" "user_id" |
1057bffa |
fi |
b2fdafea |
|
d0860cc2 |
if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
configure_cinder_driver |
b2fdafea |
fi |
0db17137 |
|
1eb4c6a3 |
if is_fedora && [[ $DISTRO =~ (rhel6) ]]; then |
0db17137 |
# Cinder clones are slightly larger due to some extra
# metadata. RHEL6 will not allow auto-extending of LV's
# without this, leading to clones giving hard-to-track disk
# I/O errors.
# see https://bugzilla.redhat.com/show_bug.cgi?id=975052
sudo sed -i~ \
-e 's/snapshot_autoextend_threshold =.*/snapshot_autoextend_threshold = 80/' \
-e 's/snapshot_autoextend_percent =.*/snapshot_autoextend_percent = 20/' \
/etc/lvm/lvm.conf
fi
|
05bd7b80 |
iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS" |
18d4778c |
iniset $CINDER_CONF DEFAULT glance_api_servers "${GLANCE_SERVICE_PROTOCOL}://${GLANCE_HOSTPORT}"
if is_ssl_enabled_service glance || is_service_enabled tls-proxy; then
iniset $CINDER_CONF DEFAULT glance_protocol https |
4b109297 |
iniset $CINDER_CONF DEFAULT glance_ca_certificates_file $SSL_BUNDLE_FILE |
18d4778c |
fi
# Register SSL certificates if provided
if is_ssl_enabled_service cinder; then
ensure_certificates CINDER
iniset $CINDER_CONF DEFAULT ssl_cert_file "$CINDER_SSL_CERT"
iniset $CINDER_CONF DEFAULT ssl_key_file "$CINDER_SSL_KEY"
fi
|
67787e6b |
}
|
671c16e6 |
# create_cinder_accounts() - Set up common required cinder accounts
# Tenant User Roles
# ------------------------------------------------------------------
# service cinder admin # if enabled
# Migrated from keystone_data.sh |
aee18c74 |
function create_cinder_accounts { |
671c16e6 |
|
e8a35acd |
local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
local admin_role=$(openstack role list | awk "/ admin / { print \$2 }") |
671c16e6 |
# Cinder
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then |
0abde393 |
|
e8a35acd |
local cinder_user=$(get_or_create_user "cinder" \
"$SERVICE_PASSWORD" $service_tenant)
get_or_add_user_role $admin_role $cinder_user $service_tenant |
0abde393 |
|
671c16e6 |
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
0abde393 |
|
e8a35acd |
local cinder_service=$(get_or_create_service "cinder" \ |
0abde393 |
"volume" "Cinder Volume Service") |
e8a35acd |
get_or_create_endpoint $cinder_service "$REGION_NAME" \ |
0abde393 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s"
|
e8a35acd |
local cinder_v2_service=$(get_or_create_service "cinderv2" \ |
0abde393 |
"volumev2" "Cinder Volume Service V2") |
e8a35acd |
get_or_create_endpoint $cinder_v2_service "$REGION_NAME" \ |
0abde393 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" |
671c16e6 |
fi
fi
}
|
f03bafeb |
# create_cinder_cache_dir() - Part of the init_cinder() process |
aee18c74 |
function create_cinder_cache_dir { |
f03bafeb |
# Create cache dir
sudo mkdir -p $CINDER_AUTH_CACHE_DIR
sudo chown $STACK_USER $CINDER_AUTH_CACHE_DIR
rm -f $CINDER_AUTH_CACHE_DIR/*
}
|
67787e6b |
# init_cinder() - Initialize database and volume group |
e8a35acd |
# Uses global ``NOVA_ENABLED_APIS`` |
aee18c74 |
function init_cinder { |
67787e6b |
# Force nova volumes off
NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/osapi_volume,//")
|
428af5a2 |
if is_service_enabled $DATABASE_BACKENDS; then |
f03bafeb |
# (Re)create cinder database |
428af5a2 |
recreate_database cinder utf8 |
67787e6b |
|
f03bafeb |
# Migrate cinder database |
9fbeeddc |
$CINDER_BIN_DIR/cinder-manage db sync |
67787e6b |
fi
|
09718335 |
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then |
e8a35acd |
local be be_name be_type |
09718335 |
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
e8a35acd |
be_type=${be%%:*}
be_name=${be##*:}
if type init_cinder_backend_${be_type} >/dev/null 2>&1; then
init_cinder_backend_${be_type} ${be_name} |
0230aa89 |
fi |
09718335 |
done |
67787e6b |
fi |
bc071bce |
|
09718335 |
mkdir -p $CINDER_STATE_PATH/volumes |
f03bafeb |
create_cinder_cache_dir |
67787e6b |
}
# install_cinder() - Collect source and prepare |
aee18c74 |
function install_cinder { |
67787e6b |
git_clone $CINDER_REPO $CINDER_DIR $CINDER_BRANCH |
4bf9d7a7 |
setup_develop $CINDER_DIR |
253a1a35 |
} |
4bf9d7a7 |
|
253a1a35 |
# install_cinderclient() - Collect source and prepare |
aee18c74 |
function install_cinderclient { |
e08ab104 |
if use_library_from_git "python-cinderclient"; then
git_clone_by_name "python-cinderclient"
setup_dev_lib "python-cinderclient"
sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-cinderclient"]}/tools/,/etc/bash_completion.d/}cinder.bash_completion |
5cb19069 |
fi |
67787e6b |
}
|
18225d92 |
# apply config.d approach for cinder volumes directory |
aee18c74 |
function _configure_tgt_for_config_d { |
18225d92 |
if [[ ! -d /etc/tgt/stack.d/ ]]; then
sudo ln -sf $CINDER_STATE_PATH/volumes /etc/tgt/stack.d
echo "include /etc/tgt/stack.d/*" | sudo tee -a /etc/tgt/targets.conf |
a39caaca |
fi
}
|
67787e6b |
# start_cinder() - Start running processes, including screen |
aee18c74 |
function start_cinder { |
18d4778c |
local service_port=$CINDER_SERVICE_PORT
local service_protocol=$CINDER_SERVICE_PROTOCOL
if is_service_enabled tls-proxy; then
service_port=$CINDER_SERVICE_PORT_INT
service_protocol="http"
fi |
67787e6b |
if is_service_enabled c-vol; then |
18225d92 |
# Delete any old stack.conf
sudo rm -f /etc/tgt/conf.d/stack.conf |
b79574b4 |
_configure_tgt_for_config_d |
c18b9651 |
if is_ubuntu; then |
d5b52ca7 |
sudo service tgt restart |
00011c08 |
elif is_fedora; then |
3b57829e |
if [[ $DISTRO =~ (rhel6) ]]; then
sudo /sbin/service tgtd restart
else
# bypass redirection to systemctl during restart
sudo /sbin/service --skip-redirect tgtd restart
fi |
00011c08 |
elif is_suse; then
restart_service tgtd
else
# note for other distros: unstack.sh also uses the tgt/tgtd service
# name, and would need to be adjusted too
exit_distro_not_supported "restarting tgt" |
67787e6b |
fi |
384454de |
# NOTE(gfidente): ensure tgtd is running in debug mode
sudo tgtadm --mode system --op update --name debug --value on |
67787e6b |
fi
|
3159a821 |
run_process c-api "$CINDER_BIN_DIR/cinder-api --config-file $CINDER_CONF" |
09718335 |
echo "Waiting for Cinder API to start..." |
18d4778c |
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$CINDER_SERVICE_HOST:$service_port; then |
09718335 |
die $LINENO "c-api did not start"
fi
|
3159a821 |
run_process c-sch "$CINDER_BIN_DIR/cinder-scheduler --config-file $CINDER_CONF"
run_process c-bak "$CINDER_BIN_DIR/cinder-backup --config-file $CINDER_CONF"
run_process c-vol "$CINDER_BIN_DIR/cinder-volume --config-file $CINDER_CONF" |
e6d4fe5f |
# NOTE(jdg): For cinder, startup order matters. To ensure that repor_capabilities is received
# by the scheduler start the cinder-volume service last (or restart it) after the scheduler
# has started. This is a quick fix for lp bug/1189595 |
560346b5 |
# Start proxies if enabled
if is_service_enabled c-api && is_service_enabled tls-proxy; then
start_tls_proxy '*' $CINDER_SERVICE_PORT $CINDER_SERVICE_HOST $CINDER_SERVICE_PORT_INT &
fi |
67787e6b |
}
|
699a29f7 |
# stop_cinder() - Stop running processes |
aee18c74 |
function stop_cinder { |
699a29f7 |
# Kill the cinder screen windows |
e8a35acd |
local serv |
67068ef4 |
for serv in c-api c-bak c-sch c-vol; do |
2f27a0ed |
stop_process $serv |
699a29f7 |
done |
67787e6b |
if is_service_enabled c-vol; then |
90dd96d4 |
if is_ubuntu; then
stop_service tgt
else
stop_service tgtd
fi |
67787e6b |
fi
} |
7903b795 |
|
09718335 |
# create_volume_types() - Create Cinder's configured volume types
function create_volume_types {
# Create volume types
if is_service_enabled c-api && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then |
e8a35acd |
local be be_name be_type |
09718335 |
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do |
e8a35acd |
be_type=${be%%:*}
be_name=${be##*:}
# openstack volume type create --property volume_backend_name="${be_type}" ${be_name}
cinder type-create ${be_name} && \
cinder type-key ${be_name} set volume_backend_name="${be_name}" |
09718335 |
done
fi
}
# Compatibility for Grenade
function create_cinder_volume_group {
# During a transition period Grenade needs to have this function defined
# It is effectively a no-op in the Grenade 'target' use case
:
}
|
cc6b4435 |
|
7903b795 |
# Restore xtrace
$XTRACE |
584d90ec |
|
6a5aa7c6 |
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: |