Merge "devstack-plugin-glusterfs: Adding checks for error conditions"
This commit is contained in:
commit
860ee45312
|
@ -87,7 +87,9 @@ function cleanup_glusterfs {
|
|||
local vol_name
|
||||
|
||||
# Cleaning up Cinder GlusterFS shares
|
||||
_delete_gluster_shares $CINDER_GLUSTERFS_SHARES
|
||||
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "True" ]; then
|
||||
_delete_gluster_shares $CINDER_GLUSTERFS_SHARES
|
||||
fi
|
||||
|
||||
if [[ -e ${GLUSTERFS_DISK_IMAGE} ]]; then
|
||||
sudo rm -f ${GLUSTERFS_DISK_IMAGE}
|
||||
|
|
|
@ -19,6 +19,35 @@
|
|||
# Defaults
|
||||
# --------
|
||||
|
||||
# Set CONFIGURE_GLUSTERFS_CINDER to true, to enable GlusterFS as a backend for Cinder.
|
||||
CONFIGURE_GLUSTERFS_CINDER=${CONFIGURE_GLUSTERFS_CINDER:-True}
|
||||
|
||||
# Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for cinder.
|
||||
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ]; then
|
||||
echo "GlusterFS plugin enabled but not selected as a backend for Cinder."
|
||||
echo "Please set CONFIGURE_GLUSTERFS_CINDER to True in localrc."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# When CONFIGURE_GLUSTERFS_CINDER is true, CINDER_ENABLED_BACKENDS should have
|
||||
# at least one backend of type 'glusterfs', error out otherwise.
|
||||
local is_gluster_backend_configured=False
|
||||
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
||||
if [ "${be%%:*}" = "glusterfs" ]; then
|
||||
is_gluster_backend_configured=True
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "True" ] && [ "$is_gluster_backend_configured" = "False" ]; then
|
||||
echo "CONFIGURE_GLUSTERFS_CINDER is set to True, to configure GlusterFS as a backend for Cinder."
|
||||
echo "But, glusterfs backend type not present in CINDER_ENABLED_BACKENDS."
|
||||
echo "Please enable at least one backend of type glusterfs in CINDER_ENABLED_BACKENDS."
|
||||
exit 1
|
||||
elif [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$is_gluster_backend_configured" = "True" ]; then
|
||||
echo "Configured Glusterfs as backend type in CINDER_ENABLED_BACKENDS. But CONFIGURE_GLUSTERFS_CINDER set to False."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# GLUSTERFS_PLUGIN_DIR contains the path to devstack-plugin-glusterfs/devstack directory
|
||||
GLUSTERFS_PLUGIN_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
|
||||
|
||||
|
|
Loading…
Reference in New Issue