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"