[devstack] don't try to configure ZFS backend if already present

Change-Id: I4b7476f4b8be3592ddef7d6a01c74dfb1a6d0db4
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commit is contained in:
Sahid Orentino Ferdjaoui 2018-12-12 09:49:38 -05:00 committed by sahid
parent d63ff87304
commit 13bb85bf96
1 changed files with 19 additions and 14 deletions

View File

@ -104,20 +104,25 @@ function test_config_nova-lxd() {
}
function configure_lxd_block() {
echo_summary "Configure LXD storage backend"
if is_ubuntu; then
if [ "$LXD_BACKEND_DRIVER" == "default" ]; then
echo "Nothing to be done"
elif [ "$LXD_BACKEND_DRIVER" == "zfs" ]; then
echo "Configuring ZFS backend"
truncate -s $LXD_LOOPBACK_DISK_SIZE $LXD_DISK_IMAGE
# TODO(sahid): switch to use snap
sudo apt-get install -y zfsutils-linux
lxd_dev=`sudo losetup --show -f ${LXD_DISK_IMAGE}`
sudo lxd init --auto --storage-backend zfs --storage-pool $LXD_ZFS_ZPOOL \
--storage-create-device $lxd_dev
fi
fi
echo_summary "Configure LXD storage backend"
if is_ubuntu; then
if [ "$LXD_BACKEND_DRIVER" == "default" ]; then
echo "Nothing to be done"
elif [ "$LXD_BACKEND_DRIVER" == "zfs" ]; then
pool=`lxc profile device get default root pool 2>> /dev/null || :`
if [ "$pool" != "$LXD_ZFS_ZPOOL" ]; then
echo "Configuring ZFS backend"
truncate -s $LXD_LOOPBACK_DISK_SIZE $LXD_DISK_IMAGE
# TODO(sahid): switch to use snap
sudo apt-get install -y zfsutils-linux
lxd_dev=`sudo losetup --show -f ${LXD_DISK_IMAGE}`
sudo lxd init --auto --storage-backend zfs --storage-pool $LXD_ZFS_ZPOOL \
--storage-create-device $lxd_dev
else
echo "ZFS backend already configured"
fi
fi
fi
}
function shutdown_nova-lxd() {