Fix cinder element to make volumes persistent
The element's os-refresh-config script was failing because /var/run/cinder does not exist. It does not exist because /var/run is usually tmpfs or cleared out before boot proceeds. Closes-Bug: #1261403 Change-Id: Ic7042728e64159c83431c11eb1ab1bba6e7e656c
This commit is contained in:
parent
5ec4a2ee15
commit
2a887fedfb
@ -2,3 +2,4 @@ os-svc-install
|
||||
os-refresh-config
|
||||
os-apply-config
|
||||
source-repositories
|
||||
use-ephemeral
|
||||
|
@ -9,8 +9,10 @@ os-svc-daemon cinder-api cinder cinder-api "--config-dir /etc/cinder"
|
||||
os-svc-daemon cinder-volume cinder cinder-volume "--config-dir /etc/cinder"
|
||||
os-svc-daemon cinder-scheduler cinder cinder-scheduler "--config-dir /etc/cinder"
|
||||
mkdir -p /etc/tgt/conf.d
|
||||
install -d -o root -g cinder -m 0770 /var/lib/cinder/volumes
|
||||
register-state-path /var/lib/cinder
|
||||
echo 'include /etc/tgt/conf.d/cinder_tgt.conf' > /etc/tgt/targets.conf
|
||||
echo 'include /var/run/cinder/volumes/*' > /etc/tgt/conf.d/cinder_tgt.conf
|
||||
echo 'include /mnt/state/var/lib/cinder/volumes/*' > /etc/tgt/conf.d/cinder_tgt.conf
|
||||
|
||||
cp -a /opt/stack/cinder/etc/cinder/rootwrap* /etc/cinder
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
[DEFAULT]
|
||||
debug = False
|
||||
|
||||
state_path = /var/run/cinder
|
||||
state_path = /mnt/state/var/lib/cinder
|
||||
|
||||
rootwrap_config=/etc/cinder/rootwrap.conf
|
||||
api_paste_config = /etc/cinder/api-paste.ini
|
||||
|
@ -4,12 +4,13 @@ set -eu
|
||||
# TODO: resize volume group in response to config changes.
|
||||
# TODO: is there a safe way to shrink a volume group?
|
||||
vol_group=cinder-volumes
|
||||
vol_file=/var/run/cinder/$vol_group-backing-file
|
||||
vol_file=/mnt/state/var/lib/cinder/${vol_group}-backing-file
|
||||
size=$(os-apply-config --key cinder.volume_size_mb --type int)M
|
||||
|
||||
if ! vgs $vol_group; then
|
||||
[[ -f $vol_file ]] || truncate -s $size $vol_file
|
||||
if ! [ -f $vol_file ] ; then
|
||||
truncate -s $size $vol_file
|
||||
fi
|
||||
dev=`sudo losetup -f --show $vol_file`
|
||||
if ! vgs $vol_group; then vgcreate $vol_group $dev; fi
|
||||
mkdir -p /var/run/cinder/volumes
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user