diskimage-builder/elements/cinder/os-refresh-config/migration.d/72-cinder-resize-volume-groups
Clint Byrum 91351658b3 Install os-refresh-config scripts automatically
Updating the cinder element to reflect the new desired way to ship
os-refresh-config scripts.

Change-Id: Ibde1275725241204f6097ad7cc0ba0de5e6cd431
2013-03-06 11:23:59 -08:00

16 lines
489 B
Bash
Executable File

#!/bin/bash
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
size=$(os-config-applier --key cinder.volume_size_mb --type int)M
if ! vgs $vol_group; then
[[ -f $vol_file ]] || truncate -s $size $vol_file
dev=`sudo losetup -f --show $vol_file`
if ! vgs $vol_group; then vgcreate $vol_group $dev; fi
mkdir -p /var/run/cinder/volumes
fi