devstack-plugin-glusterfs: GlusterFS as a backup driver for Cinder

This patch allows devstack-plugin-glusterfs to configure GlusterFS
as Cinder backup target. Below are the new configuration options
added:
* CONFIGURE_GLUSTERFS_BACKUP (Set it to True to enable glusterfs backup)
* CINDER_GLUSTERFS_BACKUP_SHARE (ex: 127.0.0.1:/backup_vol)

Depends-On: I4f0c36cdaa7cc417cb26bc1e908c6d107a71da35
Change-Id: I03f1daa0c32fda20dc1900ed73e6ad586aee37a7
This commit is contained in:
Bharat Kumar Kobagana 2015-08-19 12:32:37 +05:30
parent b52022d3e1
commit a8f8ba0a6e
2 changed files with 27 additions and 2 deletions

View File

@ -91,6 +91,10 @@ function cleanup_glusterfs {
_delete_gluster_shares $CINDER_GLUSTERFS_SHARES
fi
# Cleaning up Cinder Backup GlusterFS shares
if [ "$CONFIGURE_GLUSTERFS_BACKUP" = "True" ]; then
_delete_gluster_shares $CINDER_GLUSTERFS_BACKUP_SHARE
fi
# Cleaning up Glance GlusterFS share
if [ "$CONFIGURE_GLUSTERFS_GLANCE" = "True" ]; then
_delete_gluster_shares $GLANCE_GLUSTERFS_SHARE
@ -166,6 +170,16 @@ function configure_cinder_backend_glusterfs {
fi
}
# Configure GlusterFS as Cinder backup target
# Triggered from plugin.sh
function configure_cinder_backup_backend_glusterfs {
_create_gluster_volumes $CINDER_GLUSTERFS_BACKUP_SHARE
iniset $CINDER_CONF DEFAULT backup_driver "cinder.backup.drivers.glusterfs"
iniset $CINDER_CONF DEFAULT glusterfs_backup_share "$CINDER_GLUSTERFS_BACKUP_SHARE"
}
# Mount gluster volume
function _mount_gluster_volume {
local mount_dir=$1

View File

@ -13,6 +13,7 @@
# - install_glusterfs
# - start_glusterfs
# - configure_cinder_backend_glusterfs
# - configure_cinder_backup_backend_glusterfs
# - configure_glance_backend_glusterfs
# - configure_nova_backend_glusterfs
# - configure_manila_backend_glusterfs
@ -25,6 +26,9 @@
# Set CONFIGURE_GLUSTERFS_CINDER to true, to enable GlusterFS as a backend for Cinder.
CONFIGURE_GLUSTERFS_CINDER=${CONFIGURE_GLUSTERFS_CINDER:-True}
# Set CONFIGURE_GLUSTERFS_BACKUP to true, to configure GlusterFS as a backup driver for Cinder.
CONFIGURE_GLUSTERFS_BACKUP=${CONFIGURE_GLUSTERFS_BACKUP:-$CONFIGURE_GLUSTERFS_CINDER}
# Set CONFIGURE_GLUSTERFS_GLANCE to true, to configure GlusterFS as a backend for Glance.
CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-False}
@ -44,9 +48,9 @@ GLUSTERFS_VG_NAME=${GLUSTERFS_VG_NAME:-glusterfs-vg}
GLUSTERFS_THIN_POOL_NAME=${GLUSTERFS_THIN_POOL_NAME:-glusterfs-thinpool}
# 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" ] && [ "$CONFIGURE_GLUSTERFS_MANILA" = "False" ]; then
if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ] && [ "$CONFIGURE_GLUSTERFS_MANILA" = "False" && [ "$CONFIGURE_GLUSTERFS_BACKUP" = "False" ]; then
echo "GlusterFS plugin enabled but not selected as a backend for Cinder, Glance, Nova or Manila."
echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_GLANCE, CONFIGURE_GLUSTERFS_NOVA and/or CONFIGURE_GLUSTERFS_MANILA to True in localrc."
echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_BACKUP, CONFIGURE_GLUSTERFS_GLANCE, CONFIGURE_GLUSTERFS_NOVA and/or CONFIGURE_GLUSTERFS_MANILA to True in localrc."
exit 1
fi
@ -88,6 +92,9 @@ GLUSTERFS_LOOPBACK_DISK_SIZE=${GLUSTERFS_LOOPBACK_DISK_SIZE:-4G}
# By default CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1"
CINDER_GLUSTERFS_SHARES=${CINDER_GLUSTERFS_SHARES:-"127.0.0.1:/cinder-vol"}
# GlusterFS shares for Cinder backup
CINDER_GLUSTERFS_BACKUP_SHARE=${CINDER_GLUSTERFS_BACKUP_SHARE:-"127.0.0.1:/backup_vol"}
# Glance GlusterFS share
GLANCE_GLUSTERFS_SHARE=${GLANCE_GLUSTERFS_SHARE:-"127.0.0.1:/glance-vol"}
@ -104,6 +111,10 @@ if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
echo_summary "Installing GlusterFS"
install_glusterfs
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
if is_service_enabled c-bak && [[ "$CONFIGURE_GLUSTERFS_BACKUP" == "True" ]]; then
echo_summary "Configuring GlusterFS as a backend for Cinder backup driver"
configure_cinder_backup_backend_glusterfs
fi
if is_service_enabled glance && [[ "$CONFIGURE_GLUSTERFS_GLANCE" == "True" ]]; then
echo_summary "Configuring GlusterFS as a backend for Glance"
configure_glance_backend_glusterfs