diskimage-builder/elements/cinder/migration
Tim Miller aa8a2174a6 Add a cinder element.
Change-Id: I4729cf003896c3b4f8267d16e1b4822099231051
2013-02-28 17:09:30 -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