Browse Source

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
Bharat Kumar Kobagana 3 years ago
parent
commit
a8f8ba0a6e
2 changed files with 27 additions and 2 deletions
  1. 14
    0
      devstack/gluster-functions.sh
  2. 13
    2
      devstack/plugin.sh

+ 14
- 0
devstack/gluster-functions.sh View File

@@ -91,6 +91,10 @@ function cleanup_glusterfs {
91 91
         _delete_gluster_shares $CINDER_GLUSTERFS_SHARES
92 92
     fi
93 93
 
94
+    # Cleaning up Cinder Backup GlusterFS shares
95
+    if [ "$CONFIGURE_GLUSTERFS_BACKUP" = "True" ]; then
96
+        _delete_gluster_shares $CINDER_GLUSTERFS_BACKUP_SHARE
97
+    fi
94 98
     # Cleaning up Glance GlusterFS share
95 99
     if [ "$CONFIGURE_GLUSTERFS_GLANCE" = "True" ]; then
96 100
         _delete_gluster_shares $GLANCE_GLUSTERFS_SHARE
@@ -166,6 +170,16 @@ function configure_cinder_backend_glusterfs {
166 170
     fi
167 171
 }
168 172
 
173
+
174
+# Configure GlusterFS as Cinder backup target
175
+# Triggered from plugin.sh
176
+function configure_cinder_backup_backend_glusterfs {
177
+    _create_gluster_volumes $CINDER_GLUSTERFS_BACKUP_SHARE
178
+
179
+    iniset $CINDER_CONF DEFAULT backup_driver "cinder.backup.drivers.glusterfs"
180
+    iniset $CINDER_CONF DEFAULT glusterfs_backup_share "$CINDER_GLUSTERFS_BACKUP_SHARE"
181
+}
182
+
169 183
 # Mount gluster volume
170 184
 function _mount_gluster_volume {
171 185
     local mount_dir=$1

+ 13
- 2
devstack/plugin.sh View File

@@ -13,6 +13,7 @@
13 13
 # - install_glusterfs
14 14
 # - start_glusterfs
15 15
 # - configure_cinder_backend_glusterfs
16
+# - configure_cinder_backup_backend_glusterfs
16 17
 # - configure_glance_backend_glusterfs
17 18
 # - configure_nova_backend_glusterfs
18 19
 # - configure_manila_backend_glusterfs
@@ -25,6 +26,9 @@
25 26
 # Set CONFIGURE_GLUSTERFS_CINDER to true, to enable GlusterFS as a backend for Cinder.
26 27
 CONFIGURE_GLUSTERFS_CINDER=${CONFIGURE_GLUSTERFS_CINDER:-True}
27 28
 
29
+# Set CONFIGURE_GLUSTERFS_BACKUP to true, to configure GlusterFS as a backup driver for Cinder.
30
+CONFIGURE_GLUSTERFS_BACKUP=${CONFIGURE_GLUSTERFS_BACKUP:-$CONFIGURE_GLUSTERFS_CINDER}
31
+
28 32
 # Set CONFIGURE_GLUSTERFS_GLANCE to true, to configure GlusterFS as a backend for Glance.
29 33
 CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-False}
30 34
 
@@ -44,9 +48,9 @@ GLUSTERFS_VG_NAME=${GLUSTERFS_VG_NAME:-glusterfs-vg}
44 48
 GLUSTERFS_THIN_POOL_NAME=${GLUSTERFS_THIN_POOL_NAME:-glusterfs-thinpool}
45 49
 
46 50
 # Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for Cinder, Glance or Nova.
47
-if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ] && [ "$CONFIGURE_GLUSTERFS_MANILA" = "False" ];  then
51
+if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ] && [ "$CONFIGURE_GLUSTERFS_MANILA" = "False" && [ "$CONFIGURE_GLUSTERFS_BACKUP" = "False" ];  then
48 52
     echo "GlusterFS plugin enabled but not selected as a backend for Cinder, Glance, Nova or Manila."
49
-    echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_GLANCE, CONFIGURE_GLUSTERFS_NOVA and/or CONFIGURE_GLUSTERFS_MANILA to True in localrc."
53
+    echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_BACKUP, CONFIGURE_GLUSTERFS_GLANCE, CONFIGURE_GLUSTERFS_NOVA and/or CONFIGURE_GLUSTERFS_MANILA to True in localrc."
50 54
     exit 1
51 55
 fi
52 56
 
@@ -88,6 +92,9 @@ GLUSTERFS_LOOPBACK_DISK_SIZE=${GLUSTERFS_LOOPBACK_DISK_SIZE:-4G}
88 92
 # By default CINDER_GLUSTERFS_SHARES="127.0.0.1:/vol1"
89 93
 CINDER_GLUSTERFS_SHARES=${CINDER_GLUSTERFS_SHARES:-"127.0.0.1:/cinder-vol"}
90 94
 
95
+# GlusterFS shares for Cinder backup
96
+CINDER_GLUSTERFS_BACKUP_SHARE=${CINDER_GLUSTERFS_BACKUP_SHARE:-"127.0.0.1:/backup_vol"}
97
+
91 98
 # Glance GlusterFS share
92 99
 GLANCE_GLUSTERFS_SHARE=${GLANCE_GLUSTERFS_SHARE:-"127.0.0.1:/glance-vol"}
93 100
 
@@ -104,6 +111,10 @@ if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
104 111
     echo_summary "Installing GlusterFS"
105 112
     install_glusterfs
106 113
 elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
114
+    if is_service_enabled c-bak && [[ "$CONFIGURE_GLUSTERFS_BACKUP" == "True" ]]; then
115
+        echo_summary "Configuring GlusterFS as a backend for Cinder backup driver"
116
+        configure_cinder_backup_backend_glusterfs
117
+    fi
107 118
     if is_service_enabled glance && [[ "$CONFIGURE_GLUSTERFS_GLANCE" == "True" ]]; then
108 119
         echo_summary "Configuring GlusterFS as a backend for Glance"
109 120
         configure_glance_backend_glusterfs

Loading…
Cancel
Save