devstack-plugin-glusterfs: GlusterFS as a backend for nova

This patch enables GlusterFS as a backend for Nova. This
patch also introduces two new configuration parameters
 * CONFIGURE_GLUSTERFS_NOVA - set to 'True', to enable GlusterFS
as a backend for Nova.
 * NOVA_GLUSTERFS_SHARE - which specifies the GlusterFS share
to store compute instances.

Change-Id: Iaebc0aff704d1203b91967af06b06bb08fde51bd
This commit is contained in:
Bharat Kumar Kobagana 2015-08-06 13:25:44 +05:30 committed by Deepak C Shetty
parent 51d7091ed6
commit 7e7f058d84
3 changed files with 30 additions and 4 deletions

View File

@ -96,6 +96,11 @@ function cleanup_glusterfs {
_delete_gluster_shares $GLANCE_GLUSTERFS_SHARE
fi
# Cleaning up Nova GlusterFS share
if [ "$CONFIGURE_GLUSTERFS_NOVA" = "True" ]; then
_delete_gluster_shares $NOVA_GLUSTERFS_SHARE
fi
if [[ -e ${GLUSTERFS_DISK_IMAGE} ]]; then
sudo rm -f ${GLUSTERFS_DISK_IMAGE}
fi
@ -180,3 +185,10 @@ function configure_glance_backend_glusterfs {
_mount_gluster_volume $GLANCE_IMAGE_DIR $GLANCE_GLUSTERFS_SHARE
}
# Configure GlusterFS as a backend for Nova
function configure_nova_backend_glusterfs {
_create_gluster_volumes $NOVA_GLUSTERFS_SHARE
_mount_gluster_volume $NOVA_INSTANCES_PATH $NOVA_GLUSTERFS_SHARE
}

View File

@ -14,6 +14,7 @@
# - start_glusterfs
# - configure_cinder_backend_glusterfs
# - configure_glance_backend_glusterfs
# - configure_nova_backend_glusterfs
# - stop_glusterfs
# - cleanup_glusterfs
@ -26,10 +27,13 @@ CONFIGURE_GLUSTERFS_CINDER=${CONFIGURE_GLUSTERFS_CINDER:-True}
# Set CONFIGURE_GLUSTERFS_GLANCE to true, to configure GlusterFS as a backend for Glance.
CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-False}
# Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for cinder.
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ]; then
echo "GlusterFS plugin enabled but not selected as a backend for Cinder or Glance."
echo "Please set CONFIGURE_GLUSTERFS_CINDER and/or CONFIGURE_GLUSTERFS_GLANCE to True in localrc."
# Set CONFIGURE_GLUSTERFS_NOVA to true, to configure GlusterFS as a backend for Nova.
CONFIGURE_GLUSTERFS_NOVA=${CONFIGURE_GLUSTERFS_NOVA:-False}
# Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for Cinder, Glance or Nova.
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ]; then
echo "GlusterFS plugin enabled but not selected as a backend for Cinder, Glance or Nova."
echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_GLANCE and/or CONFIGURE_GLUSTERFS_NOVA to True in localrc."
exit 1
fi
@ -74,6 +78,9 @@ CINDER_GLUSTERFS_SHARES=${CINDER_GLUSTERFS_SHARES:-"127.0.0.1:/cinder-vol"}
# Glance GlusterFS share
GLANCE_GLUSTERFS_SHARE=${GLANCE_GLUSTERFS_SHARE:-"127.0.0.1:/glance-vol"}
# Glance Nova share
NOVA_GLUSTERFS_SHARE=${NOVA_GLUSTERFS_SHARE:-"127.0.0.1:/nova-vol"}
# Adding GlusterFS repo to CentOS / RHEL 7 platform.
GLUSTERFS_CENTOS_REPO=${GLUSTERFS_CENTOS_REPO:-"http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo"}
@ -88,6 +95,10 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring GlusterFS as a backend for Glance"
configure_glance_backend_glusterfs
fi
if is_service_enabled nova && [[ "$CONFIGURE_GLUSTERFS_NOVA" == "True" ]]; then
echo_summary "Configuring GlusterFS as a backend for Nova"
configure_nova_backend_glusterfs
fi
fi
if [[ "$1" == "unstack" ]]; then

View File

@ -17,3 +17,6 @@ GLUSTERFS_VOLUME_PROV_TYPE=${GLUSTERFS_VOLUME_PROV_TYPE:-thick}
# Enabling GlusterFS as a backend for Glace
CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-True}
# Enabling GlusterFS as a backend for Nova
CONFIGURE_GLUSTERFS_NOVA=${CONFIGURE_GLUSTERFS_NOVA:-True}