From d2f9efeeda472e8a12ed07e4330342d081f06ba7 Mon Sep 17 00:00:00 2001 From: marios Date: Thu, 15 Oct 2015 14:43:55 +0300 Subject: [PATCH] Adds LIBVIRT_VOL_POOL_TARGET to tripleo create-nodes During dev setup in a vm environment, the default OS partitioning may result in insufficient space for the libvirt default storage pool which defaults (and we also hard-code) to /var/lib/libvirt/images This change means you can export LIBVIRT_VOL_POOL_TARGET before instack-virt-setup to get the libvirt default storage pool created there (and the directory is created if necessary). Change-Id: I85d51457fbd8b747f55091f3ecdc6ca921b70b84 --- scripts/create-nodes | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/create-nodes b/scripts/create-nodes index 9c190396..fe1b2719 100755 --- a/scripts/create-nodes +++ b/scripts/create-nodes @@ -24,12 +24,16 @@ BRIDGE_NAMES=${9:-""} LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"} LIBVIRT_VOL_POOL=${LIBVIRT_VOL_POOL:-"default"} +LIBVIRT_VOL_POOL_TARGET=${LIBVIRT_VOL_POOL_TARGET:-"/var/lib/libvirt/images"} -# define the default storage pool if its not there yet -(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) || \ - (virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target /var/lib/libvirt/images; \ +# define the $LIBVIRT_VOL_POOL storage pool if its not there yet +if ! $(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) ; then + if [ ! -d $LIBVIRT_VOL_POOL_TARGET ]; then + sudo mkdir -p $LIBVIRT_VOL_POOL_TARGET ; + fi + (virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target $LIBVIRT_VOL_POOL_TARGET ; \ virsh pool-autostart $LIBVIRT_VOL_POOL; virsh pool-start $LIBVIRT_VOL_POOL) >&2 - +fi PREALLOC= if [ "${TRIPLEO_OS_FAMILY:-}" = "debian" ]; then PREALLOC="--prealloc-metadata"