2014-12-05 14:25:28 -05:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2012-05-02 11:48:15 -05:00
|
|
|
# lib/cinder
|
2012-12-21 11:03:37 -06:00
|
|
|
# Install and start **Cinder** volume service
|
2012-05-02 11:48:15 -05:00
|
|
|
|
|
|
|
# Dependencies:
|
2013-10-24 11:27:02 +01:00
|
|
|
#
|
2012-05-02 11:48:15 -05:00
|
|
|
# - functions
|
2013-01-06 22:40:09 +01:00
|
|
|
# - DEST, DATA_DIR, STACK_USER must be defined
|
2013-10-24 11:27:02 +01:00
|
|
|
# - SERVICE_{TENANT_NAME|PASSWORD} must be defined
|
|
|
|
# - ``KEYSTONE_TOKEN_FORMAT`` must be defined
|
2012-05-02 11:48:15 -05:00
|
|
|
|
|
|
|
# stack.sh
|
|
|
|
# ---------
|
2013-10-24 11:27:02 +01:00
|
|
|
# - install_cinder
|
|
|
|
# - configure_cinder
|
|
|
|
# - init_cinder
|
|
|
|
# - start_cinder
|
|
|
|
# - stop_cinder
|
|
|
|
# - cleanup_cinder
|
2012-05-02 11:48:15 -05:00
|
|
|
|
2012-09-13 17:16:12 -05:00
|
|
|
# Save trace setting
|
2015-10-13 11:03:03 +11:00
|
|
|
_XTRACE_CINDER=$(set +o | grep xtrace)
|
2012-09-13 17:16:12 -05:00
|
|
|
set +o xtrace
|
2012-05-02 11:48:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
# Defaults
|
|
|
|
# --------
|
|
|
|
|
2012-11-20 15:52:21 +00:00
|
|
|
# set up default driver
|
|
|
|
CINDER_DRIVER=${CINDER_DRIVER:-default}
|
2014-01-23 11:31:10 -07:00
|
|
|
CINDER_PLUGINS=$TOP_DIR/lib/cinder_plugins
|
2014-07-03 10:46:57 -05:00
|
|
|
CINDER_BACKENDS=$TOP_DIR/lib/cinder_backends
|
2021-01-11 13:42:46 -05:00
|
|
|
CINDER_BACKUPS=$TOP_DIR/lib/cinder_backups
|
2014-01-23 11:31:10 -07:00
|
|
|
|
|
|
|
# grab plugin config if specified via cinder_driver
|
|
|
|
if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
|
|
|
|
source $CINDER_PLUGINS/$CINDER_DRIVER
|
|
|
|
fi
|
2012-11-20 15:52:21 +00:00
|
|
|
|
2012-05-02 11:48:15 -05:00
|
|
|
# set up default directories
|
2014-11-13 17:09:28 -05:00
|
|
|
GITDIR["python-cinderclient"]=$DEST/python-cinderclient
|
2016-05-26 23:41:49 +03:00
|
|
|
GITDIR["python-brick-cinderclient-ext"]=$DEST/python-brick-cinderclient-ext
|
2012-05-02 11:48:15 -05:00
|
|
|
CINDER_DIR=$DEST/cinder
|
2015-02-18 07:09:04 -06:00
|
|
|
|
|
|
|
# Cinder virtual environment
|
|
|
|
if [[ ${USE_VENV} = True ]]; then
|
|
|
|
PROJECT_VENV["cinder"]=${CINDER_DIR}.venv
|
|
|
|
CINDER_BIN_DIR=${PROJECT_VENV["cinder"]}/bin
|
|
|
|
else
|
|
|
|
CINDER_BIN_DIR=$(get_python_exec_prefix)
|
|
|
|
fi
|
|
|
|
|
2012-09-13 14:02:01 -05:00
|
|
|
CINDER_STATE_PATH=${CINDER_STATE_PATH:=$DATA_DIR/cinder}
|
2012-12-13 16:22:38 -06:00
|
|
|
|
2012-09-13 14:02:01 -05:00
|
|
|
CINDER_CONF_DIR=/etc/cinder
|
|
|
|
CINDER_CONF=$CINDER_CONF_DIR/cinder.conf
|
2017-03-03 18:09:35 +00:00
|
|
|
CINDER_UWSGI=$CINDER_BIN_DIR/cinder-wsgi
|
|
|
|
CINDER_UWSGI_CONF=$CINDER_CONF_DIR/cinder-api-uwsgi.ini
|
2012-12-13 16:22:38 -06:00
|
|
|
CINDER_API_PASTE_INI=$CINDER_CONF_DIR/api-paste.ini
|
2012-09-13 14:02:01 -05:00
|
|
|
|
2012-12-13 17:05:24 -06:00
|
|
|
# Public facing bits
|
2017-04-13 10:11:48 -04:00
|
|
|
if is_service_enabled tls-proxy; then
|
2014-03-19 17:47:42 -04:00
|
|
|
CINDER_SERVICE_PROTOCOL="https"
|
|
|
|
fi
|
2012-12-13 17:05:24 -06:00
|
|
|
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}
|
2017-09-19 10:52:32 +00:00
|
|
|
CINDER_SERVICE_LISTEN_ADDRESS=${CINDER_SERVICE_LISTEN_ADDRESS:-$(ipv6_unquote $SERVICE_LISTEN_ADDRESS)}
|
2012-12-13 17:05:24 -06:00
|
|
|
|
2015-05-12 17:28:59 -06:00
|
|
|
# What type of LVM device should Cinder use for LVM backend
|
2017-09-05 19:56:06 -05:00
|
|
|
# Defaults to auto, which will do thin provisioning if it's a fresh
|
|
|
|
# volume group, otherwise it will do thick. The other valid choices are
|
|
|
|
# default, which is thick, or thin, which as the name implies utilizes lvm
|
|
|
|
# thin provisioning.
|
|
|
|
CINDER_LVM_TYPE=${CINDER_LVM_TYPE:-auto}
|
2014-07-03 10:46:57 -05:00
|
|
|
|
|
|
|
# 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.
|
2014-12-18 16:31:34 -06:00
|
|
|
# The old ``CINDER_MULTI_LVM_BACKEND=True`` setting had a default of:
|
|
|
|
# CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1,lvm:lvmdriver-2}
|
|
|
|
CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1}
|
2014-07-03 10:46:57 -05:00
|
|
|
|
2015-04-29 15:39:17 -04:00
|
|
|
CINDER_VOLUME_CLEAR=${CINDER_VOLUME_CLEAR:-${CINDER_VOLUME_CLEAR_DEFAULT:-zero}}
|
|
|
|
CINDER_VOLUME_CLEAR=$(echo ${CINDER_VOLUME_CLEAR} | tr '[:upper:]' '[:lower:]')
|
2013-03-18 16:07:56 -05:00
|
|
|
|
2021-03-09 22:36:57 +00:00
|
|
|
# Default to lioadm
|
|
|
|
CINDER_ISCSI_HELPER=${CINDER_ISCSI_HELPER:-lioadm}
|
|
|
|
|
2021-04-28 09:26:23 +01:00
|
|
|
# EL and SUSE should only use lioadm
|
2018-09-24 12:34:15 +02:00
|
|
|
if is_fedora || is_suse; then
|
2017-04-19 15:42:34 +10:00
|
|
|
if [[ ${CINDER_ISCSI_HELPER} != "lioadm" ]]; then
|
2018-02-25 14:48:05 +00:00
|
|
|
die "lioadm is the only valid Cinder target_helper config on this platform"
|
2017-04-19 15:42:34 +10:00
|
|
|
fi
|
|
|
|
fi
|
2015-01-26 15:44:47 +01:00
|
|
|
|
2020-10-13 14:20:38 -04:00
|
|
|
# When Cinder is used as a backend for Glance, it can be configured to clone
|
|
|
|
# the volume containing image data directly in the backend instead of
|
|
|
|
# transferring data from volume to volume. Value is a comma separated list of
|
|
|
|
# schemes (currently only 'file' and 'cinder' are supported). The default
|
|
|
|
# configuration in Cinder is empty (that is, do not use this feature). NOTE:
|
|
|
|
# to use this feature you must also enable GLANCE_SHOW_DIRECT_URL and/or
|
|
|
|
# GLANCE_SHOW_MULTIPLE_LOCATIONS for glance-api.conf.
|
|
|
|
CINDER_ALLOWED_DIRECT_URL_SCHEMES=${CINDER_ALLOWED_DIRECT_URL_SCHEMES:-}
|
|
|
|
if [[ -n "$CINDER_ALLOWED_DIRECT_URL_SCHEMES" ]]; then
|
|
|
|
if [[ "${GLANCE_SHOW_DIRECT_URL:-False}" != "True" \
|
|
|
|
&& "${GLANCE_SHOW_MULTIPLE_LOCATIONS:-False}" != "True" ]]; then
|
|
|
|
warn $LINENO "CINDER_ALLOWED_DIRECT_URL_SCHEMES is set, but neither \
|
|
|
|
GLANCE_SHOW_DIRECT_URL nor GLANCE_SHOW_MULTIPLE_LOCATIONS is True"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-01-11 13:42:46 -05:00
|
|
|
# For backward compatibility
|
|
|
|
# Before CINDER_BACKUP_DRIVER was introduced, ceph backup driver was configured
|
|
|
|
# along with ceph backend driver.
|
|
|
|
if [[ -z "${CINDER_BACKUP_DRIVER}" && "$CINDER_ENABLED_BACKENDS" =~ "ceph" ]]; then
|
|
|
|
CINDER_BACKUP_DRIVER=ceph
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Supported backup drivers are in lib/cinder_backups
|
|
|
|
CINDER_BACKUP_DRIVER=${CINDER_BACKUP_DRIVER:-swift}
|
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
# Toggle for deploying Cinder under a wsgi server. Legacy mod_wsgi
|
|
|
|
# reference should be cleaned up to more accurately refer to uwsgi.
|
|
|
|
CINDER_USE_MOD_WSGI=${CINDER_USE_MOD_WSGI:-True}
|
2013-04-08 15:38:03 -05:00
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
# Source the enabled backends
|
|
|
|
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
|
|
|
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
2014-07-25 12:37:41 -05:00
|
|
|
be_type=${be%%:*}
|
|
|
|
be_name=${be##*:}
|
|
|
|
if [[ -r $CINDER_BACKENDS/${be_type} ]]; then
|
|
|
|
source $CINDER_BACKENDS/${be_type}
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2021-01-11 13:42:46 -05:00
|
|
|
# Source the backup driver
|
|
|
|
if is_service_enabled c-bak && [[ -n "$CINDER_BACKUP_DRIVER" ]]; then
|
|
|
|
if [[ -r $CINDER_BACKUPS/$CINDER_BACKUP_DRIVER ]]; then
|
|
|
|
source $CINDER_BACKUPS/$CINDER_BACKUP_DRIVER
|
|
|
|
else
|
|
|
|
die "cinder backup driver $CINDER_BACKUP_DRIVER is not supported"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-05-03 17:34:00 -07:00
|
|
|
# Environment variables to configure the image-volume cache
|
|
|
|
CINDER_IMG_CACHE_ENABLED=${CINDER_IMG_CACHE_ENABLED:-True}
|
|
|
|
|
|
|
|
# For limits, if left unset, it will use cinder defaults of 0 for unlimited
|
|
|
|
CINDER_IMG_CACHE_SIZE_GB=${CINDER_IMG_CACHE_SIZE_GB:-}
|
|
|
|
CINDER_IMG_CACHE_SIZE_COUNT=${CINDER_IMG_CACHE_SIZE_COUNT:-}
|
|
|
|
|
|
|
|
# Configure which cinder backends will have the image-volume cache, this takes the same
|
|
|
|
# form as the CINDER_ENABLED_BACKENDS config option. By default it will
|
|
|
|
# enable the cache for all cinder backends.
|
|
|
|
CINDER_CACHE_ENABLED_FOR_BACKENDS=${CINDER_CACHE_ENABLED_FOR_BACKENDS:-$CINDER_ENABLED_BACKENDS}
|
2014-07-03 10:46:57 -05:00
|
|
|
|
2021-03-06 17:23:39 -06:00
|
|
|
# Flag to set the oslo_policy.enforce_scope. This is used to switch
|
|
|
|
# the Volume API policies to start checking the scope of token. by default,
|
|
|
|
# this flag is False.
|
|
|
|
# For more detail: https://docs.openstack.org/oslo.policy/latest/configuration/index.html#oslo_policy.enforce_scope
|
|
|
|
CINDER_ENFORCE_SCOPE=$(trueorfalse False CINDER_ENFORCE_SCOPE)
|
|
|
|
|
2013-04-08 15:38:03 -05:00
|
|
|
# Functions
|
|
|
|
# ---------
|
2014-01-15 15:04:49 -06:00
|
|
|
|
|
|
|
# Test if any Cinder services are enabled
|
|
|
|
# is_cinder_enabled
|
|
|
|
function is_cinder_enabled {
|
2017-05-30 14:11:09 -07:00
|
|
|
[[ ,${DISABLED_SERVICES} =~ ,"cinder" ]] && return 1
|
2014-01-15 15:04:49 -06:00
|
|
|
[[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2015-09-01 10:55:20 +03:00
|
|
|
# _cinder_cleanup_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
|
|
|
|
function _cinder_cleanup_apache_wsgi {
|
|
|
|
sudo rm -f $(apache_site_config_for osapi-volume)
|
|
|
|
}
|
|
|
|
|
2012-05-02 11:48:15 -05:00
|
|
|
# cleanup_cinder() - Remove residual data files, anything left over from previous
|
|
|
|
# runs that a clean run would need to clean up
|
2014-02-21 15:35:08 +11:00
|
|
|
function cleanup_cinder {
|
2012-12-20 16:41:57 -05:00
|
|
|
# ensure the volume group is cleared up because fails might
|
|
|
|
# leave dead volumes in the group
|
2015-01-26 15:44:47 +01:00
|
|
|
if [ "$CINDER_ISCSI_HELPER" = "tgtadm" ]; then
|
2015-10-07 14:06:26 +11:00
|
|
|
local targets
|
|
|
|
targets=$(sudo tgtadm --op show --mode target)
|
2015-01-26 15:44:47 +01:00
|
|
|
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
|
|
|
|
targets=$(sudo tgtadm --op show --mode target)
|
2012-12-20 16:41:57 -05:00
|
|
|
fi
|
|
|
|
|
2015-01-26 15:44:47 +01:00
|
|
|
if [[ -n "$targets" ]]; then
|
|
|
|
local iqn_list=( $(grep --no-filename -r iqn $SCSI_PERSIST_DIR | sed 's/<target //' | sed 's/>//') )
|
|
|
|
for i in "${iqn_list[@]}"; do
|
|
|
|
echo removing iSCSI target: $i
|
|
|
|
sudo tgt-admin --delete $i
|
|
|
|
done
|
|
|
|
fi
|
2012-12-20 16:41:57 -05:00
|
|
|
|
2015-01-26 15:44:47 +01:00
|
|
|
if is_ubuntu; then
|
|
|
|
stop_service tgt
|
|
|
|
else
|
|
|
|
stop_service tgtd
|
|
|
|
fi
|
2012-12-20 16:41:57 -05:00
|
|
|
else
|
2015-01-26 15:44:47 +01:00
|
|
|
sudo cinder-rtstool get-targets | sudo xargs -rn 1 cinder-rtstool delete
|
2012-12-20 16:41:57 -05:00
|
|
|
fi
|
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
|
2014-07-25 12:37:41 -05:00
|
|
|
local be be_name be_type
|
2014-07-03 10:46:57 -05:00
|
|
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
2014-07-25 12:37:41 -05:00
|
|
|
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}
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
|
|
|
done
|
2013-02-22 17:28:10 +01:00
|
|
|
fi
|
2015-09-01 10:55:20 +03:00
|
|
|
|
2021-01-11 13:42:46 -05:00
|
|
|
if is_service_enabled c-bak && [[ -n "$CINDER_BACKUP_DRIVER" ]]; then
|
|
|
|
if type cleanup_cinder_backup_$CINDER_BACKUP_DRIVER >/dev/null 2>&1; then
|
|
|
|
cleanup_cinder_backup_$CINDER_BACKUP_DRIVER
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
stop_process "c-api"
|
|
|
|
remove_uwsgi_config "$CINDER_UWSGI_CONF" "$CINDER_UWSGI"
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
|
|
|
|
2014-01-10 14:23:03 +01:00
|
|
|
# configure_cinder() - Set config files, create data dirs, etc
|
2014-02-21 15:35:08 +11:00
|
|
|
function configure_cinder {
|
2015-03-16 13:52:19 -05:00
|
|
|
sudo install -d -o $STACK_USER -m 755 $CINDER_CONF_DIR
|
2014-01-10 14:23:03 +01:00
|
|
|
|
2015-01-05 17:05:47 +08:00
|
|
|
rm -f $CINDER_CONF
|
|
|
|
|
2015-05-14 10:01:53 +10:00
|
|
|
configure_rootwrap cinder
|
2012-07-20 13:18:17 -06:00
|
|
|
|
2017-05-04 17:56:22 +08:00
|
|
|
if [[ -f "$CINDER_DIR/etc/cinder/resource_filters.json" ]]; then
|
|
|
|
cp -p "$CINDER_DIR/etc/cinder/resource_filters.json" "$CINDER_CONF_DIR/resource_filters.json"
|
|
|
|
fi
|
|
|
|
|
2012-05-02 11:48:15 -05:00
|
|
|
cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
|
2013-10-16 18:57:15 -04:00
|
|
|
|
|
|
|
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
|
2013-09-20 16:26:42 +10:00
|
|
|
inicomment $CINDER_API_PASTE_INI filter:authtoken cafile
|
2013-10-16 18:57:15 -04:00
|
|
|
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
|
2017-10-04 09:51:02 +11:00
|
|
|
inicomment $CINDER_API_PASTE_INI filter:authtoken signing_dir
|
2012-10-01 14:06:44 -05:00
|
|
|
|
2017-11-17 19:52:29 +01:00
|
|
|
configure_keystone_authtoken_middleware $CINDER_CONF cinder
|
2013-10-16 18:57:15 -04:00
|
|
|
|
2013-08-10 09:56:16 -05:00
|
|
|
iniset $CINDER_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
|
2014-07-03 10:46:57 -05:00
|
|
|
|
2018-02-25 14:48:05 +00:00
|
|
|
iniset $CINDER_CONF DEFAULT target_helper "$CINDER_ISCSI_HELPER"
|
2015-03-06 15:24:22 -08:00
|
|
|
iniset $CINDER_CONF database connection `database_connection_url cinder`
|
2012-05-02 11:48:15 -05:00
|
|
|
iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI
|
2013-02-20 12:45:02 -08:00
|
|
|
iniset $CINDER_CONF DEFAULT rootwrap_config "$CINDER_CONF_DIR/rootwrap.conf"
|
2013-01-28 09:53:38 -05:00
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_extension cinder.api.contrib.standard_extensions
|
2015-06-16 13:14:31 -04:00
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_listen $CINDER_SERVICE_LISTEN_ADDRESS
|
2012-09-13 14:02:01 -05:00
|
|
|
iniset $CINDER_CONF DEFAULT state_path $CINDER_STATE_PATH
|
2015-03-06 15:24:22 -08:00
|
|
|
iniset $CINDER_CONF oslo_concurrency lock_path $CINDER_STATE_PATH
|
2019-07-29 10:42:24 +00:00
|
|
|
if [[ $SERVICE_IP_VERSION == 6 ]]; then
|
|
|
|
iniset $CINDER_CONF DEFAULT my_ip "$HOST_IPV6"
|
|
|
|
else
|
|
|
|
iniset $CINDER_CONF DEFAULT my_ip "$HOST_IP"
|
|
|
|
fi
|
2017-09-22 07:49:15 -05:00
|
|
|
iniset $CINDER_CONF key_manager backend cinder.keymgr.conf_key_mgr.ConfKeyManager
|
2017-08-30 07:36:11 +03:00
|
|
|
iniset $CINDER_CONF key_manager fixed_key $(openssl rand -hex 16)
|
2020-10-13 14:20:38 -04:00
|
|
|
if [[ -n "$CINDER_ALLOWED_DIRECT_URL_SCHEMES" ]]; then
|
|
|
|
iniset $CINDER_CONF DEFAULT allowed_direct_url_schemes $CINDER_ALLOWED_DIRECT_URL_SCHEMES
|
|
|
|
fi
|
2016-01-26 22:46:13 -05:00
|
|
|
|
2021-08-04 18:27:48 -04:00
|
|
|
# set default quotas
|
|
|
|
iniset $CINDER_CONF DEFAULT quota_volumes ${CINDER_QUOTA_VOLUMES:-10}
|
|
|
|
iniset $CINDER_CONF DEFAULT quota_backups ${CINDER_QUOTA_BACKUPS:-10}
|
|
|
|
iniset $CINDER_CONF DEFAULT quota_snapshots ${CINDER_QUOTA_SNAPSHOTS:-10}
|
|
|
|
|
2020-12-23 10:52:20 +00:00
|
|
|
# Avoid RPC timeouts in slow CI and test environments by doubling the
|
|
|
|
# default response timeout set by RPC clients. See bug #1873234 for more
|
|
|
|
# details and example failures.
|
|
|
|
iniset $CINDER_CONF DEFAULT rpc_response_timeout 120
|
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
|
2014-07-25 12:37:41 -05:00
|
|
|
local enabled_backends=""
|
|
|
|
local default_name=""
|
|
|
|
local be be_name be_type
|
2014-07-03 10:46:57 -05:00
|
|
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
2014-07-25 12:37:41 -05:00
|
|
|
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}
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
2014-08-28 09:29:47 -05:00
|
|
|
if [[ -z "$default_name" ]]; then
|
|
|
|
default_name=$be_name
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
2014-07-25 12:37:41 -05:00
|
|
|
enabled_backends+=$be_name,
|
2014-07-03 10:46:57 -05:00
|
|
|
done
|
|
|
|
iniset $CINDER_CONF DEFAULT enabled_backends ${enabled_backends%,*}
|
2014-07-25 13:35:53 -07:00
|
|
|
if [[ -n "$default_name" ]]; then
|
|
|
|
iniset $CINDER_CONF DEFAULT default_volume_type ${default_name}
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
2016-05-03 17:34:00 -07:00
|
|
|
configure_cinder_image_volume_cache
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
|
|
|
|
2021-01-11 13:42:46 -05:00
|
|
|
if is_service_enabled c-bak && [[ -n "$CINDER_BACKUP_DRIVER" ]]; then
|
|
|
|
if type configure_cinder_backup_$CINDER_BACKUP_DRIVER >/dev/null 2>&1; then
|
|
|
|
configure_cinder_backup_$CINDER_BACKUP_DRIVER
|
|
|
|
else
|
|
|
|
die "configure_cinder_backup_$CINDER_BACKUP_DRIVER doesn't exist in $CINDER_BACKUPS/$CINDER_BACKUP_DRIVER"
|
|
|
|
fi
|
2014-03-09 18:36:42 +01:00
|
|
|
fi
|
|
|
|
|
2013-08-09 10:55:12 -04:00
|
|
|
if is_service_enabled ceilometer; then
|
2017-03-05 13:07:39 -05:00
|
|
|
iniset $CINDER_CONF oslo_messaging_notifications driver "messagingv2"
|
2013-08-09 10:55:12 -04:00
|
|
|
fi
|
|
|
|
|
2012-12-13 17:05:24 -06:00
|
|
|
if is_service_enabled tls-proxy; then
|
2017-03-03 18:09:35 +00:00
|
|
|
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
|
|
|
|
# Set the service port for a proxy to take the original
|
|
|
|
if [ "$CINDER_USE_MOD_WSGI" == "True" ]; then
|
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_listen_port $CINDER_SERVICE_PORT_INT
|
2017-08-29 14:40:26 +00:00
|
|
|
iniset $CINDER_CONF oslo_middleware enable_proxy_headers_parsing True
|
2017-03-03 18:09:35 +00:00
|
|
|
else
|
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_listen_port $CINDER_SERVICE_PORT_INT
|
|
|
|
iniset $CINDER_CONF DEFAULT public_endpoint $CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT
|
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_base_URL $CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT
|
|
|
|
fi
|
|
|
|
fi
|
2012-12-13 17:05:24 -06:00
|
|
|
fi
|
|
|
|
|
2012-11-06 20:38:14 -06:00
|
|
|
if [ "$SYSLOG" != "False" ]; then
|
|
|
|
iniset $CINDER_CONF DEFAULT use_syslog True
|
|
|
|
fi
|
|
|
|
|
2015-03-14 12:39:14 -05:00
|
|
|
iniset_rpc_backend cinder $CINDER_CONF
|
2012-08-06 11:15:36 -04:00
|
|
|
|
2013-08-20 14:51:08 -07:00
|
|
|
# Format logging
|
2016-04-05 12:08:57 -04:00
|
|
|
setup_logging $CINDER_CONF $CINDER_USE_MOD_WSGI
|
2012-11-20 15:52:21 +00:00
|
|
|
|
2021-03-09 17:32:25 +00:00
|
|
|
if is_service_enabled c-api; then
|
|
|
|
write_uwsgi_config "$CINDER_UWSGI_CONF" "$CINDER_UWSGI" "/volume"
|
|
|
|
fi
|
2015-09-01 10:55:20 +03:00
|
|
|
|
2014-01-23 11:31:10 -07:00
|
|
|
if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then
|
|
|
|
configure_cinder_driver
|
2012-11-20 15:52:21 +00:00
|
|
|
fi
|
2013-06-26 22:31:48 +10:00
|
|
|
|
2014-09-16 17:25:33 -05:00
|
|
|
iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
|
2014-03-19 17:47:42 -04:00
|
|
|
|
2017-06-23 22:32:37 +00:00
|
|
|
iniset $CINDER_CONF DEFAULT glance_api_servers "$GLANCE_URL"
|
2017-04-13 10:11:48 -04:00
|
|
|
if is_service_enabled tls-proxy; then
|
2014-03-19 17:47:42 -04:00
|
|
|
iniset $CINDER_CONF DEFAULT glance_protocol https
|
2014-10-21 18:17:48 -04:00
|
|
|
iniset $CINDER_CONF DEFAULT glance_ca_certificates_file $SSL_BUNDLE_FILE
|
2014-03-19 17:47:42 -04:00
|
|
|
fi
|
|
|
|
|
2017-05-23 16:52:35 +02:00
|
|
|
# Set nova credentials (used for os-assisted-snapshots)
|
2017-11-17 19:52:29 +01:00
|
|
|
configure_keystone_authtoken_middleware $CINDER_CONF nova nova
|
2017-05-23 16:52:35 +02:00
|
|
|
iniset $CINDER_CONF nova region_name "$REGION_NAME"
|
2015-10-22 15:47:49 -04:00
|
|
|
iniset $CINDER_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
|
2016-12-01 16:11:17 +01:00
|
|
|
|
2017-05-19 10:23:46 -04:00
|
|
|
if [[ ! -z "$CINDER_COORDINATION_URL" ]]; then
|
|
|
|
iniset $CINDER_CONF coordination backend_url "$CINDER_COORDINATION_URL"
|
|
|
|
elif is_service_enabled etcd3; then
|
2017-11-28 08:20:48 -05:00
|
|
|
iniset $CINDER_CONF coordination backend_url "etcd3+http://${SERVICE_HOST}:$ETCD_PORT"
|
2016-12-01 16:11:17 +01:00
|
|
|
fi
|
2021-03-06 17:23:39 -06:00
|
|
|
|
|
|
|
if [[ "$CINDER_ENFORCE_SCOPE" == True ]] ; then
|
|
|
|
iniset $CINDER_CONF oslo_policy enforce_scope true
|
|
|
|
iniset $CINDER_CONF oslo_policy enforce_new_defaults true
|
|
|
|
fi
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
|
|
|
|
2012-12-13 16:22:38 -06:00
|
|
|
# create_cinder_accounts() - Set up common required cinder accounts
|
|
|
|
|
|
|
|
# Tenant User Roles
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# service cinder admin # if enabled
|
|
|
|
|
|
|
|
# Migrated from keystone_data.sh
|
2014-02-21 15:35:08 +11:00
|
|
|
function create_cinder_accounts {
|
2012-12-13 16:22:38 -06:00
|
|
|
# Cinder
|
|
|
|
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
|
2014-02-28 14:15:19 +01:00
|
|
|
|
2015-02-10 20:38:56 +11:00
|
|
|
create_service_user "cinder"
|
2014-02-28 14:15:19 +01:00
|
|
|
|
2017-10-10 11:49:06 -05:00
|
|
|
# block-storage is the official service type
|
|
|
|
get_or_create_service "cinder" "block-storage" "Cinder Volume Service"
|
2017-03-03 18:09:35 +00:00
|
|
|
if [ "$CINDER_USE_MOD_WSGI" == "False" ]; then
|
2017-10-10 11:49:06 -05:00
|
|
|
get_or_create_endpoint \
|
|
|
|
"block-storage" \
|
|
|
|
"$REGION_NAME" \
|
2018-05-01 05:57:21 -05:00
|
|
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s"
|
2017-10-10 11:49:06 -05:00
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
get_or_create_service "cinderv3" "volumev3" "Cinder Volume Service V3"
|
|
|
|
get_or_create_endpoint \
|
|
|
|
"volumev3" \
|
|
|
|
"$REGION_NAME" \
|
|
|
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s"
|
|
|
|
else
|
2017-10-10 11:49:06 -05:00
|
|
|
get_or_create_endpoint \
|
|
|
|
"block-storage" \
|
|
|
|
"$REGION_NAME" \
|
2018-05-01 05:57:21 -05:00
|
|
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST/volume/v3/\$(project_id)s"
|
2017-10-10 11:49:06 -05:00
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
get_or_create_service "cinderv3" "volumev3" "Cinder Volume Service V3"
|
|
|
|
get_or_create_endpoint \
|
|
|
|
"volumev3" \
|
|
|
|
"$REGION_NAME" \
|
|
|
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST/volume/v3/\$(project_id)s"
|
|
|
|
fi
|
2016-05-03 17:34:00 -07:00
|
|
|
|
|
|
|
configure_cinder_internal_tenant
|
2012-12-13 16:22:38 -06:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-05-02 11:48:15 -05:00
|
|
|
# init_cinder() - Initialize database and volume group
|
2014-02-21 15:35:08 +11:00
|
|
|
function init_cinder {
|
2012-11-01 16:12:39 -04:00
|
|
|
if is_service_enabled $DATABASE_BACKENDS; then
|
2013-02-12 10:58:28 -06:00
|
|
|
# (Re)create cinder database
|
2014-10-06 13:29:39 +02:00
|
|
|
recreate_database cinder
|
2012-05-02 11:48:15 -05:00
|
|
|
|
2017-06-14 12:09:21 -07:00
|
|
|
time_start "dbsync"
|
2013-02-12 10:58:28 -06:00
|
|
|
# Migrate cinder database
|
2016-05-04 08:14:01 +00:00
|
|
|
$CINDER_BIN_DIR/cinder-manage --config-file $CINDER_CONF db sync
|
2017-06-14 12:09:21 -07:00
|
|
|
time_stop "dbsync"
|
2012-05-02 11:48:15 -05:00
|
|
|
fi
|
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
|
2014-07-25 12:37:41 -05:00
|
|
|
local be be_name be_type
|
2014-07-03 10:46:57 -05:00
|
|
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
2014-07-25 12:37:41 -05:00
|
|
|
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}
|
2012-06-14 08:51:01 +02:00
|
|
|
fi
|
2014-07-03 10:46:57 -05:00
|
|
|
done
|
2012-05-02 11:48:15 -05:00
|
|
|
fi
|
2012-10-01 14:06:44 -05:00
|
|
|
|
2021-01-11 13:42:46 -05:00
|
|
|
if is_service_enabled c-bak && [[ -n "$CINDER_BACKUP_DRIVER" ]]; then
|
|
|
|
if type init_cinder_backup_$CINDER_BACKUP_DRIVER >/dev/null 2>&1; then
|
|
|
|
init_cinder_backup_$CINDER_BACKUP_DRIVER
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
mkdir -p $CINDER_STATE_PATH/volumes
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# install_cinder() - Collect source and prepare
|
2014-02-21 15:35:08 +11:00
|
|
|
function install_cinder {
|
2012-05-02 11:48:15 -05:00
|
|
|
git_clone $CINDER_REPO $CINDER_DIR $CINDER_BRANCH
|
2013-04-01 16:41:39 -04:00
|
|
|
setup_develop $CINDER_DIR
|
2017-04-19 15:42:34 +10:00
|
|
|
if [[ "$CINDER_ISCSI_HELPER" == "tgtadm" ]]; then
|
|
|
|
install_package tgt
|
2017-12-11 12:01:32 +01:00
|
|
|
elif [[ "$CINDER_ISCSI_HELPER" == "lioadm" ]]; then
|
2020-06-28 08:55:28 +00:00
|
|
|
if is_ubuntu; then
|
2019-03-13 23:41:05 +05:30
|
|
|
# TODO(frickler): Workaround for https://launchpad.net/bugs/1819819
|
|
|
|
sudo mkdir -p /etc/target
|
|
|
|
|
2019-03-04 17:50:47 -05:00
|
|
|
install_package targetcli-fb
|
|
|
|
else
|
|
|
|
install_package targetcli
|
|
|
|
fi
|
2015-01-26 15:44:47 +01:00
|
|
|
fi
|
2013-04-01 18:23:22 -05:00
|
|
|
}
|
2013-04-01 16:41:39 -04:00
|
|
|
|
2013-04-01 18:23:22 -05:00
|
|
|
# install_cinderclient() - Collect source and prepare
|
2014-02-21 15:35:08 +11:00
|
|
|
function install_cinderclient {
|
2016-05-26 23:41:49 +03:00
|
|
|
if use_library_from_git "python-brick-cinderclient-ext"; then
|
|
|
|
git_clone_by_name "python-brick-cinderclient-ext"
|
|
|
|
setup_dev_lib "python-brick-cinderclient-ext"
|
|
|
|
fi
|
|
|
|
|
2014-11-13 17:09:28 -05:00
|
|
|
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
|
2014-11-01 01:37:45 +01:00
|
|
|
fi
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
|
|
|
|
2013-04-14 12:48:41 -07:00
|
|
|
# apply config.d approach for cinder volumes directory
|
2014-02-21 15:35:08 +11:00
|
|
|
function _configure_tgt_for_config_d {
|
2013-04-14 12:48:41 -07:00
|
|
|
if [[ ! -d /etc/tgt/stack.d/ ]]; then
|
|
|
|
sudo ln -sf $CINDER_STATE_PATH/volumes /etc/tgt/stack.d
|
2016-01-07 19:40:44 +01:00
|
|
|
fi
|
|
|
|
if ! grep -q "include /etc/tgt/stack.d/*" /etc/tgt/targets.conf; then
|
2013-04-14 12:48:41 -07:00
|
|
|
echo "include /etc/tgt/stack.d/*" | sudo tee -a /etc/tgt/targets.conf
|
2012-09-03 15:45:53 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-08-30 14:16:58 -04:00
|
|
|
# start_cinder() - Start running processes
|
2014-02-21 15:35:08 +11:00
|
|
|
function start_cinder {
|
2014-03-19 17:47:42 -04:00
|
|
|
local service_port=$CINDER_SERVICE_PORT
|
|
|
|
local service_protocol=$CINDER_SERVICE_PROTOCOL
|
2017-03-03 18:09:35 +00:00
|
|
|
local cinder_url
|
2017-08-02 11:40:41 -04:00
|
|
|
if is_service_enabled tls-proxy && [ "$CINDER_USE_MOD_WSGI" == "False" ]; then
|
2014-03-19 17:47:42 -04:00
|
|
|
service_port=$CINDER_SERVICE_PORT_INT
|
|
|
|
service_protocol="http"
|
|
|
|
fi
|
2015-01-26 15:44:47 +01:00
|
|
|
if [ "$CINDER_ISCSI_HELPER" = "tgtadm" ]; then
|
|
|
|
if is_service_enabled c-vol; then
|
|
|
|
# Delete any old stack.conf
|
|
|
|
sudo rm -f /etc/tgt/conf.d/stack.conf
|
|
|
|
_configure_tgt_for_config_d
|
|
|
|
if is_ubuntu; then
|
|
|
|
sudo service tgt restart
|
2015-06-01 12:39:12 +02:00
|
|
|
elif is_suse; then
|
|
|
|
# NOTE(dmllr): workaround restart bug
|
|
|
|
# https://bugzilla.suse.com/show_bug.cgi?id=934642
|
|
|
|
stop_service tgtd
|
|
|
|
start_service tgtd
|
2015-01-26 15:44:47 +01:00
|
|
|
else
|
2015-06-01 12:39:12 +02:00
|
|
|
restart_service tgtd
|
2015-01-26 15:44:47 +01:00
|
|
|
fi
|
|
|
|
# NOTE(gfidente): ensure tgtd is running in debug mode
|
|
|
|
sudo tgtadm --mode system --op update --name debug --value on
|
2012-05-02 11:48:15 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
|
|
|
|
if [ "$CINDER_USE_MOD_WSGI" == "False" ]; then
|
2017-05-25 14:57:19 -07:00
|
|
|
run_process c-api "$CINDER_BIN_DIR/cinder-api --config-file $CINDER_CONF"
|
2017-03-03 18:09:35 +00:00
|
|
|
cinder_url=$service_protocol://$SERVICE_HOST:$service_port
|
2017-08-28 11:49:28 +00:00
|
|
|
# Start proxy if tls enabled
|
|
|
|
if is_service_enabled tls-proxy; then
|
|
|
|
start_tls_proxy cinder '*' $CINDER_SERVICE_PORT $CINDER_SERVICE_HOST $CINDER_SERVICE_PORT_INT
|
2017-03-03 18:09:35 +00:00
|
|
|
fi
|
|
|
|
else
|
2018-06-22 22:23:29 +10:00
|
|
|
run_process "c-api" "$(which uwsgi) --procname-prefix cinder-api --ini $CINDER_UWSGI_CONF"
|
2017-03-03 18:09:35 +00:00
|
|
|
cinder_url=$service_protocol://$SERVICE_HOST/volume/v3
|
2017-05-25 14:57:19 -07:00
|
|
|
fi
|
2017-03-03 18:09:35 +00:00
|
|
|
fi
|
2017-02-28 15:13:02 +08:00
|
|
|
|
2017-03-03 18:09:35 +00:00
|
|
|
echo "Waiting for Cinder API to start..."
|
|
|
|
if ! wait_for_service $SERVICE_TIMEOUT $cinder_url; then
|
|
|
|
die $LINENO "c-api did not start"
|
2014-07-03 10:46:57 -05:00
|
|
|
fi
|
|
|
|
|
2014-08-27 14:13:58 -05:00
|
|
|
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"
|
2013-07-15 17:35:54 -06:00
|
|
|
|
|
|
|
# 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
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
|
|
|
|
2012-09-10 14:10:27 -05:00
|
|
|
# stop_cinder() - Stop running processes
|
2014-02-21 15:35:08 +11:00
|
|
|
function stop_cinder {
|
2017-03-03 18:09:35 +00:00
|
|
|
stop_process c-api
|
2017-08-30 14:16:58 -04:00
|
|
|
stop_process c-bak
|
|
|
|
stop_process c-sch
|
|
|
|
stop_process c-vol
|
2012-05-02 11:48:15 -05:00
|
|
|
}
|
2012-09-13 17:16:12 -05:00
|
|
|
|
2014-07-03 10:46:57 -05:00
|
|
|
# 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
|
2015-05-29 08:33:03 +00:00
|
|
|
local be be_name
|
2014-07-03 10:46:57 -05:00
|
|
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
2014-07-25 12:37:41 -05:00
|
|
|
be_name=${be##*:}
|
2017-11-06 18:17:39 +02:00
|
|
|
# NOTE (e0ne): openstack client doesn't work with cinder in noauth mode
|
|
|
|
if is_service_enabled keystone; then
|
|
|
|
openstack --os-region-name="$REGION_NAME" volume type create --property volume_backend_name="${be_name}" ${be_name}
|
|
|
|
else
|
|
|
|
# TODO (e0ne): use openstack client once it will support cinder in noauth mode:
|
|
|
|
# https://bugs.launchpad.net/python-cinderclient/+bug/1755279
|
|
|
|
local cinder_url
|
|
|
|
cinder_url=$CINDER_SERVICE_PROTOCOL://$SERVICE_HOST:$CINDER_SERVICE_PORT/v3
|
|
|
|
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-create ${be_name}
|
|
|
|
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-key ${be_name} set volume_backend_name=${be_name}
|
|
|
|
fi
|
2014-07-03 10:46:57 -05:00
|
|
|
done
|
2021-02-04 23:24:17 +00:00
|
|
|
|
|
|
|
# Increase quota for the service project if glance is using cinder,
|
|
|
|
# since it's likely to occasionally go above the default 10 in parallel
|
|
|
|
# test execution.
|
|
|
|
if [[ "$USE_CINDER_FOR_GLANCE" == "True" ]]; then
|
|
|
|
openstack --os-region-name="$REGION_NAME" \
|
|
|
|
quota set --volumes 50 "$SERVICE_PROJECT_NAME"
|
|
|
|
fi
|
2014-07-03 10:46:57 -05:00
|
|
|
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
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
2016-05-03 17:34:00 -07:00
|
|
|
function configure_cinder_internal_tenant {
|
|
|
|
# Re-use the Cinder service account for simplicity.
|
|
|
|
iniset $CINDER_CONF DEFAULT cinder_internal_tenant_project_id $(get_or_create_project $SERVICE_PROJECT_NAME)
|
|
|
|
iniset $CINDER_CONF DEFAULT cinder_internal_tenant_user_id $(get_or_create_user "cinder")
|
|
|
|
}
|
|
|
|
|
|
|
|
function configure_cinder_image_volume_cache {
|
|
|
|
# Expect CINDER_CACHE_ENABLED_FOR_BACKENDS to be a list of backends
|
|
|
|
# similar to CINDER_ENABLED_BACKENDS with NAME:TYPE where NAME will
|
|
|
|
# be the backend specific configuration stanza in cinder.conf.
|
|
|
|
for be in ${CINDER_CACHE_ENABLED_FOR_BACKENDS//,/ }; do
|
|
|
|
local be_name=${be##*:}
|
|
|
|
|
|
|
|
iniset $CINDER_CONF $be_name image_volume_cache_enabled $CINDER_IMG_CACHE_ENABLED
|
|
|
|
|
|
|
|
if [[ -n $CINDER_IMG_CACHE_SIZE_GB ]]; then
|
|
|
|
iniset $CINDER_CONF $be_name image_volume_cache_max_size_gb $CINDER_IMG_CACHE_SIZE_GB
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n $CINDER_IMG_CACHE_SIZE_COUNT ]]; then
|
|
|
|
iniset $CINDER_CONF $be_name image_volume_cache_max_count $CINDER_IMG_CACHE_SIZE_COUNT
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-04-08 15:38:03 -05:00
|
|
|
|
2012-09-13 17:16:12 -05:00
|
|
|
# Restore xtrace
|
2015-10-13 11:03:03 +11:00
|
|
|
$_XTRACE_CINDER
|
2013-03-29 14:34:53 -04:00
|
|
|
|
2013-10-24 11:27:02 +01:00
|
|
|
# Tell emacs to use shell-script-mode
|
|
|
|
## Local variables:
|
|
|
|
## mode: shell-script
|
|
|
|
## End:
|