blob: 4d1ab420a66f6827ddf89c6a8c1e750eabe0db74 [file] [log] [blame]
Dean Troyer67787e62012-05-02 11:48:15 -05001# lib/cinder
Dean Troyer6d04fd72012-12-21 11:03:37 -06002# Install and start **Cinder** volume service
Dean Troyer67787e62012-05-02 11:48:15 -05003
4# Dependencies:
5# - functions
Attila Fazekas91b8d132013-01-06 22:40:09 +01006# - DEST, DATA_DIR, STACK_USER must be defined
Dean Troyer67787e62012-05-02 11:48:15 -05007# SERVICE_{TENANT_NAME|PASSWORD} must be defined
Dean Troyerbc071bc2012-10-01 14:06:44 -05008# ``KEYSTONE_TOKEN_FORMAT`` must be defined
Dean Troyer67787e62012-05-02 11:48:15 -05009
10# stack.sh
11# ---------
Attila Fazekasb79574b2012-12-01 10:42:46 +010012# install_cinder
13# configure_cinder
14# init_cinder
15# start_cinder
16# stop_cinder
17# cleanup_cinder
Dean Troyer67787e62012-05-02 11:48:15 -050018
Dean Troyer7903b792012-09-13 17:16:12 -050019# Save trace setting
20XTRACE=$(set +o | grep xtrace)
21set +o xtrace
Dean Troyer67787e62012-05-02 11:48:15 -050022
23
24# Defaults
25# --------
26
Mate Lakatb2fdafe2012-11-20 15:52:21 +000027# set up default driver
28CINDER_DRIVER=${CINDER_DRIVER:-default}
29
Dean Troyer67787e62012-05-02 11:48:15 -050030# set up default directories
31CINDER_DIR=$DEST/cinder
Dean Troyer50ac7922012-09-13 14:02:01 -050032CINDERCLIENT_DIR=$DEST/python-cinderclient
33CINDER_STATE_PATH=${CINDER_STATE_PATH:=$DATA_DIR/cinder}
Dean Troyer671c16e2012-12-13 16:22:38 -060034CINDER_AUTH_CACHE_DIR=${CINDER_AUTH_CACHE_DIR:-/var/cache/cinder}
35
Dean Troyer50ac7922012-09-13 14:02:01 -050036CINDER_CONF_DIR=/etc/cinder
37CINDER_CONF=$CINDER_CONF_DIR/cinder.conf
Dean Troyer671c16e2012-12-13 16:22:38 -060038CINDER_API_PASTE_INI=$CINDER_CONF_DIR/api-paste.ini
Dean Troyer50ac7922012-09-13 14:02:01 -050039
Dean Troyer560346b2012-12-13 17:05:24 -060040# Public facing bits
41CINDER_SERVICE_HOST=${CINDER_SERVICE_HOST:-$SERVICE_HOST}
42CINDER_SERVICE_PORT=${CINDER_SERVICE_PORT:-8776}
43CINDER_SERVICE_PORT_INT=${CINDER_SERVICE_PORT_INT:-18776}
44CINDER_SERVICE_PROTOCOL=${CINDER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
45
Dean Troyer50ac7922012-09-13 14:02:01 -050046# Support entry points installation of console scripts
47if [[ -d $CINDER_DIR/bin ]]; then
Monty Taylor9fbeedd2012-08-17 12:52:27 -040048 CINDER_BIN_DIR=$CINDER_DIR/bin
49else
Jakub Ruzicka4196d552013-01-30 15:35:54 +010050 CINDER_BIN_DIR=$(get_python_exec_prefix)
Monty Taylor9fbeedd2012-08-17 12:52:27 -040051fi
Dean Troyer67787e62012-05-02 11:48:15 -050052
53# Name of the lvm volume group to use/create for iscsi volumes
54VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
55VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
56
Dean Troyer22853c12013-01-07 15:18:12 -060057# _clean_volume_group removes all cinder volumes from the specified volume group
58# _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
59function _clean_volume_group() {
60 local vg=$1
61 local vg_prefix=$2
62 # Clean out existing volumes
63 for lv in `sudo lvs --noheadings -o lv_name $vg`; do
64 # vg_prefix prefixes the LVs we want
65 if [[ "${lv#$vg_prefix}" != "$lv" ]]; then
66 sudo lvremove -f $vg/$lv
67 fi
68 done
69}
70
Dean Troyer67787e62012-05-02 11:48:15 -050071# cleanup_cinder() - Remove residual data files, anything left over from previous
72# runs that a clean run would need to clean up
73function cleanup_cinder() {
Sean Dague252f2f52012-12-20 16:41:57 -050074 # ensure the volume group is cleared up because fails might
75 # leave dead volumes in the group
76 TARGETS=$(sudo tgtadm --op show --mode target)
77 if [ $? -ne 0 ]; then
78 # If tgt driver isn't running this won't work obviously
79 # So check the response and restart if need be
80 echo "tgtd seems to be in a bad state, restarting..."
81 if is_ubuntu; then
82 restart_service tgt
83 else
84 restart_service tgtd
85 fi
86 TARGETS=$(sudo tgtadm --op show --mode target)
87 fi
88
89 if [[ -n "$TARGETS" ]]; then
90 iqn_list=( $(grep --no-filename -r iqn $SCSI_PERSIST_DIR | sed 's/<target //' | sed 's/>//') )
91 for i in "${iqn_list[@]}"; do
92 echo removing iSCSI target: $i
93 sudo tgt-admin --delete $i
94 done
95 fi
96
97 if is_service_enabled cinder; then
98 sudo rm -rf $CINDER_STATE_PATH/volumes/*
99 fi
100
101 if is_ubuntu; then
102 stop_service tgt
103 else
104 stop_service tgtd
105 fi
106
Dean Troyer22853c12013-01-07 15:18:12 -0600107 # Campsite rule: leave behind a volume group at least as clean as we found it
108 _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
Dean Troyer67787e62012-05-02 11:48:15 -0500109}
110
111# configure_cinder() - Set config files, create data dirs, etc
112function configure_cinder() {
113 setup_develop $CINDER_DIR
114 setup_develop $CINDERCLIENT_DIR
115
116 if [[ ! -d $CINDER_CONF_DIR ]]; then
117 sudo mkdir -p $CINDER_CONF_DIR
118 fi
Attila Fazekas91b8d132013-01-06 22:40:09 +0100119 sudo chown $STACK_USER $CINDER_CONF_DIR
Dean Troyer67787e62012-05-02 11:48:15 -0500120
121 cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
122
John Griffith4e823ff2012-07-20 13:18:17 -0600123 # Set the paths of certain binaries
Vincent Untz856a11e2012-11-21 16:04:12 +0100124 CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
John Griffith4e823ff2012-07-20 13:18:17 -0600125
126 # If Cinder ships the new rootwrap filters files, deploy them
127 # (owned by root) and add a parameter to $CINDER_ROOTWRAP
128 ROOTWRAP_CINDER_SUDOER_CMD="$CINDER_ROOTWRAP"
129 if [[ -d $CINDER_DIR/etc/cinder/rootwrap.d ]]; then
130 # Wipe any existing rootwrap.d files first
131 if [[ -d $CINDER_CONF_DIR/rootwrap.d ]]; then
132 sudo rm -rf $CINDER_CONF_DIR/rootwrap.d
133 fi
134 # Deploy filters to /etc/cinder/rootwrap.d
135 sudo mkdir -m 755 $CINDER_CONF_DIR/rootwrap.d
136 sudo cp $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d
137 sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d
138 sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/*
139 # Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d
140 sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/
141 sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf
142 sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf
143 sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf
144 # Specify rootwrap.conf as first parameter to cinder-rootwrap
145 CINDER_ROOTWRAP="$CINDER_ROOTWRAP $CINDER_CONF_DIR/rootwrap.conf"
146 ROOTWRAP_CINDER_SUDOER_CMD="$CINDER_ROOTWRAP *"
147 fi
148
149 TEMPFILE=`mktemp`
150 echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_CINDER_SUDOER_CMD" >$TEMPFILE
151 chmod 0440 $TEMPFILE
152 sudo chown root:root $TEMPFILE
153 sudo mv $TEMPFILE /etc/sudoers.d/cinder-rootwrap
154
Dean Troyer67787e62012-05-02 11:48:15 -0500155 cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
156 iniset $CINDER_API_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
157 iniset $CINDER_API_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
158 iniset $CINDER_API_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
159 iniset $CINDER_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
160 iniset $CINDER_API_PASTE_INI filter:authtoken admin_user cinder
161 iniset $CINDER_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
Akihiro MOTOKI5e3deb62012-12-11 17:09:02 +0900162 iniset $CINDER_API_PASTE_INI filter:authtoken signing_dir $CINDER_AUTH_CACHE_DIR
Dean Troyerbc071bc2012-10-01 14:06:44 -0500163
Dean Troyer67787e62012-05-02 11:48:15 -0500164 cp $CINDER_DIR/etc/cinder/cinder.conf.sample $CINDER_CONF
165 iniset $CINDER_CONF DEFAULT auth_strategy keystone
166 iniset $CINDER_CONF DEFAULT verbose True
167 iniset $CINDER_CONF DEFAULT volume_group $VOLUME_GROUP
168 iniset $CINDER_CONF DEFAULT volume_name_template ${VOLUME_NAME_PREFIX}%s
169 iniset $CINDER_CONF DEFAULT iscsi_helper tgtadm
Terry Wilson428af5a2012-11-01 16:12:39 -0400170 local dburl
171 database_connection_url dburl cinder
172 iniset $CINDER_CONF DEFAULT sql_connection $dburl
Dean Troyer67787e62012-05-02 11:48:15 -0500173 iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI
John Griffith4e823ff2012-07-20 13:18:17 -0600174 iniset $CINDER_CONF DEFAULT root_helper "sudo ${CINDER_ROOTWRAP}"
Dan Prince9f22f072013-01-28 09:53:38 -0500175 iniset $CINDER_CONF DEFAULT osapi_volume_extension cinder.api.contrib.standard_extensions
Dean Troyer50ac7922012-09-13 14:02:01 -0500176 iniset $CINDER_CONF DEFAULT state_path $CINDER_STATE_PATH
John Griffith4e823ff2012-07-20 13:18:17 -0600177
Dean Troyer560346b2012-12-13 17:05:24 -0600178 if is_service_enabled tls-proxy; then
179 # Set the service port for a proxy to take the original
180 iniset $CINDER_CONF DEFAULT osapi_volume_listen_port $CINDER_SERVICE_PORT_INT
181 fi
182
Dean Troyer4d3049e2012-11-06 20:38:14 -0600183 if [ "$SYSLOG" != "False" ]; then
184 iniset $CINDER_CONF DEFAULT use_syslog True
185 fi
186
Akihiro MOTOKIb0f1c382013-01-13 17:58:12 +0900187 iniset_rpc_backend cinder $CINDER_CONF DEFAULT
Gary Kottonf71bf192012-08-06 11:15:36 -0400188
James E. Blair213c4162012-11-06 09:38:36 +0100189 if [[ "$CINDER_SECURE_DELETE" == "False" ]]; then
190 iniset $CINDER_CONF DEFAULT secure_delete False
Pádraig Bradyeac93702013-01-02 16:02:54 +0000191 iniset $CINDER_CONF DEFAULT volume_clear none
James E. Blair213c4162012-11-06 09:38:36 +0100192 fi
193
Chmouel Boudjnah1057bff2012-08-03 11:42:51 +0000194 if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
195 # Add color to logging output
Joe Gordon07db7132013-01-30 13:07:25 -0800196 iniset $CINDER_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_id)s %(project_id)s%(color)s] %(instance)s%(color)s%(message)s"
197 iniset $CINDER_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s"
Chmouel Boudjnah1057bff2012-08-03 11:42:51 +0000198 iniset $CINDER_CONF DEFAULT logging_debug_format_suffix "from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d"
Joe Gordon07db7132013-01-30 13:07:25 -0800199 iniset $CINDER_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s"
Chmouel Boudjnah1057bff2012-08-03 11:42:51 +0000200 fi
Mate Lakatb2fdafe2012-11-20 15:52:21 +0000201
202 if [ "$CINDER_DRIVER" == "XenAPINFS" ]; then
203 (
204 set -u
Mate Lakata0ca45f2012-12-06 17:45:49 +0000205 iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.xenapi.sm.XenAPINFSDriver"
Mate Lakatb2fdafe2012-11-20 15:52:21 +0000206 iniset $CINDER_CONF DEFAULT xenapi_connection_url "$CINDER_XENAPI_CONNECTION_URL"
207 iniset $CINDER_CONF DEFAULT xenapi_connection_username "$CINDER_XENAPI_CONNECTION_USERNAME"
208 iniset $CINDER_CONF DEFAULT xenapi_connection_password "$CINDER_XENAPI_CONNECTION_PASSWORD"
209 iniset $CINDER_CONF DEFAULT xenapi_nfs_server "$CINDER_XENAPI_NFS_SERVER"
210 iniset $CINDER_CONF DEFAULT xenapi_nfs_serverpath "$CINDER_XENAPI_NFS_SERVERPATH"
211 )
MORITA Kazutakaaf22a472013-01-17 16:16:25 +0900212 elif [ "$CINDER_DRIVER" == "sheepdog" ]; then
213 iniset $CINDER_CONF DEFAULT volume_driver "cinder.volume.drivers.sheepdog.SheepdogDriver"
Mate Lakatb2fdafe2012-11-20 15:52:21 +0000214 fi
Dean Troyer67787e62012-05-02 11:48:15 -0500215}
216
Dean Troyer671c16e2012-12-13 16:22:38 -0600217# create_cinder_accounts() - Set up common required cinder accounts
218
219# Tenant User Roles
220# ------------------------------------------------------------------
221# service cinder admin # if enabled
222
223# Migrated from keystone_data.sh
224create_cinder_accounts() {
225
226 SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
227 ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
228
229 # Cinder
230 if [[ "$ENABLED_SERVICES" =~ "c-api" ]]; then
231 CINDER_USER=$(keystone user-create \
232 --name=cinder \
233 --pass="$SERVICE_PASSWORD" \
234 --tenant_id $SERVICE_TENANT \
235 --email=cinder@example.com \
236 | grep " id " | get_field 2)
237 keystone user-role-add \
238 --tenant_id $SERVICE_TENANT \
239 --user_id $CINDER_USER \
240 --role_id $ADMIN_ROLE
241 if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
242 CINDER_SERVICE=$(keystone service-create \
243 --name=cinder \
244 --type=volume \
245 --description="Cinder Volume Service" \
246 | grep " id " | get_field 2)
247 keystone endpoint-create \
248 --region RegionOne \
249 --service_id $CINDER_SERVICE \
Dean Troyer560346b2012-12-13 17:05:24 -0600250 --publicurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \
251 --adminurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s" \
252 --internalurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v1/\$(tenant_id)s"
Dean Troyer671c16e2012-12-13 16:22:38 -0600253 fi
254 fi
255}
256
Dean Troyerf03bafe2013-02-12 10:58:28 -0600257# create_cinder_cache_dir() - Part of the init_cinder() process
258function create_cinder_cache_dir() {
259 # Create cache dir
260 sudo mkdir -p $CINDER_AUTH_CACHE_DIR
261 sudo chown $STACK_USER $CINDER_AUTH_CACHE_DIR
262 rm -f $CINDER_AUTH_CACHE_DIR/*
263}
264
265create_cinder_volume_group() {
266 # Configure a default volume group called '`stack-volumes`' for the volume
267 # service if it does not yet exist. If you don't wish to use a file backed
268 # volume group, create your own volume group called ``stack-volumes`` before
269 # invoking ``stack.sh``.
270 #
271 # By default, the backing file is 5G in size, and is stored in ``/opt/stack/data``.
272
273 if ! sudo vgs $VOLUME_GROUP; then
274 VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
275
276 # Only create if the file doesn't already exists
277 [[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
278
279 DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
280
281 # Only create if the loopback device doesn't contain $VOLUME_GROUP
282 if ! sudo vgs $VOLUME_GROUP; then
283 sudo vgcreate $VOLUME_GROUP $DEV
284 fi
285 fi
286
287 mkdir -p $CINDER_STATE_PATH/volumes
288}
289
Dean Troyer67787e62012-05-02 11:48:15 -0500290# init_cinder() - Initialize database and volume group
291function init_cinder() {
292 # Force nova volumes off
293 NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/osapi_volume,//")
294
Terry Wilson428af5a2012-11-01 16:12:39 -0400295 if is_service_enabled $DATABASE_BACKENDS; then
Dean Troyerf03bafe2013-02-12 10:58:28 -0600296 # (Re)create cinder database
Terry Wilson428af5a2012-11-01 16:12:39 -0400297 recreate_database cinder utf8
Dean Troyer67787e62012-05-02 11:48:15 -0500298
Dean Troyerf03bafe2013-02-12 10:58:28 -0600299 # Migrate cinder database
Monty Taylor9fbeedd2012-08-17 12:52:27 -0400300 $CINDER_BIN_DIR/cinder-manage db sync
Dean Troyer67787e62012-05-02 11:48:15 -0500301 fi
302
303 if is_service_enabled c-vol; then
Dean Troyer67787e62012-05-02 11:48:15 -0500304
Dean Troyerf03bafe2013-02-12 10:58:28 -0600305 create_cinder_volume_group
Chuck Short3f603d92012-07-28 13:28:33 -0500306
Dean Troyer67787e62012-05-02 11:48:15 -0500307 if sudo vgs $VOLUME_GROUP; then
Vincent Untz00011c02012-12-06 09:56:32 +0100308 if is_fedora || is_suse; then
309 # service is not started by default
Vincent Untz0230aa82012-06-14 08:51:01 +0200310 start_service tgtd
311 fi
312
Dean Troyer67787e62012-05-02 11:48:15 -0500313 # Remove iscsi targets
314 sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
Dean Troyer22853c12013-01-07 15:18:12 -0600315 # Start with a clean volume group
316 _clean_volume_group $VOLUME_GROUP $VOLUME_NAME_PREFIX
Dean Troyer67787e62012-05-02 11:48:15 -0500317 fi
318 fi
Dean Troyerbc071bc2012-10-01 14:06:44 -0500319
Dean Troyerf03bafe2013-02-12 10:58:28 -0600320 create_cinder_cache_dir
Dean Troyer67787e62012-05-02 11:48:15 -0500321}
322
323# install_cinder() - Collect source and prepare
324function install_cinder() {
325 git_clone $CINDER_REPO $CINDER_DIR $CINDER_BRANCH
326 git_clone $CINDERCLIENT_REPO $CINDERCLIENT_DIR $CINDERCLIENT_BRANCH
327}
328
Mate Lakata39caac2012-09-03 15:45:53 +0100329# apply config.d approach (e.g. Oneiric does not have this)
330function _configure_tgt_for_config_d() {
331 if [[ ! -d /etc/tgt/conf.d/ ]]; then
Attila Fazekasb79574b2012-12-01 10:42:46 +0100332 sudo mkdir -p /etc/tgt/conf.d
Mate Lakata39caac2012-09-03 15:45:53 +0100333 echo "include /etc/tgt/conf.d/*.conf" | sudo tee -a /etc/tgt/targets.conf
334 fi
335}
336
Dean Troyer67787e62012-05-02 11:48:15 -0500337# start_cinder() - Start running processes, including screen
338function start_cinder() {
339 if is_service_enabled c-vol; then
Attila Fazekasb79574b2012-12-01 10:42:46 +0100340 _configure_tgt_for_config_d
341 if [[ ! -f /etc/tgt/conf.d/stack.conf ]]; then
342 echo "include $CINDER_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/stack.conf
343 fi
Vincent Untzc18b9652012-12-04 12:36:34 +0100344 if is_ubuntu; then
Dean Troyer67787e62012-05-02 11:48:15 -0500345 # tgt in oneiric doesn't restart properly if tgtd isn't running
346 # do it in two steps
347 sudo stop tgt || true
348 sudo start tgt
Vincent Untz00011c02012-12-06 09:56:32 +0100349 elif is_fedora; then
Dean Troyer67787e62012-05-02 11:48:15 -0500350 # bypass redirection to systemctl during restart
351 sudo /sbin/service --skip-redirect tgtd restart
Vincent Untz00011c02012-12-06 09:56:32 +0100352 elif is_suse; then
353 restart_service tgtd
354 else
355 # note for other distros: unstack.sh also uses the tgt/tgtd service
356 # name, and would need to be adjusted too
357 exit_distro_not_supported "restarting tgt"
Dean Troyer67787e62012-05-02 11:48:15 -0500358 fi
359 fi
360
Monty Taylor9fbeedd2012-08-17 12:52:27 -0400361 screen_it c-api "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-api --config-file $CINDER_CONF"
362 screen_it c-vol "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-volume --config-file $CINDER_CONF"
363 screen_it c-sch "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-scheduler --config-file $CINDER_CONF"
Dean Troyer560346b2012-12-13 17:05:24 -0600364
365 # Start proxies if enabled
366 if is_service_enabled c-api && is_service_enabled tls-proxy; then
367 start_tls_proxy '*' $CINDER_SERVICE_PORT $CINDER_SERVICE_HOST $CINDER_SERVICE_PORT_INT &
368 fi
Dean Troyer67787e62012-05-02 11:48:15 -0500369}
370
Dean Troyer699a29f2012-09-10 14:10:27 -0500371# stop_cinder() - Stop running processes
Dean Troyer67787e62012-05-02 11:48:15 -0500372function stop_cinder() {
Dean Troyer699a29f2012-09-10 14:10:27 -0500373 # Kill the cinder screen windows
374 for serv in c-api c-sch c-vol; do
375 screen -S $SCREEN_NAME -p $serv -X kill
376 done
Dean Troyer67787e62012-05-02 11:48:15 -0500377
378 if is_service_enabled c-vol; then
Vincent Untz90dd96d2012-12-13 08:59:57 +0100379 if is_ubuntu; then
380 stop_service tgt
381 else
382 stop_service tgtd
383 fi
Dean Troyer67787e62012-05-02 11:48:15 -0500384 fi
385}
Dean Troyer7903b792012-09-13 17:16:12 -0500386
387# Restore xtrace
388$XTRACE