Browse Source

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
Bharat Kumar Kobagana 3 years ago
parent
commit
7e7f058d84
3 changed files with 30 additions and 4 deletions
  1. 12
    0
      devstack/gluster-functions.sh
  2. 15
    4
      devstack/plugin.sh
  3. 3
    0
      devstack/settings

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

@@ -96,6 +96,11 @@ function cleanup_glusterfs {
96 96
         _delete_gluster_shares $GLANCE_GLUSTERFS_SHARE
97 97
     fi
98 98
 
99
+    # Cleaning up Nova GlusterFS share
100
+    if [ "$CONFIGURE_GLUSTERFS_NOVA" = "True" ]; then
101
+        _delete_gluster_shares $NOVA_GLUSTERFS_SHARE
102
+    fi
103
+
99 104
     if [[ -e ${GLUSTERFS_DISK_IMAGE} ]]; then
100 105
         sudo rm -f ${GLUSTERFS_DISK_IMAGE}
101 106
     fi
@@ -180,3 +185,10 @@ function configure_glance_backend_glusterfs {
180 185
 
181 186
     _mount_gluster_volume $GLANCE_IMAGE_DIR $GLANCE_GLUSTERFS_SHARE
182 187
 }
188
+
189
+# Configure GlusterFS as a backend for Nova
190
+function configure_nova_backend_glusterfs {
191
+    _create_gluster_volumes $NOVA_GLUSTERFS_SHARE
192
+
193
+    _mount_gluster_volume $NOVA_INSTANCES_PATH $NOVA_GLUSTERFS_SHARE
194
+}

+ 15
- 4
devstack/plugin.sh View File

@@ -14,6 +14,7 @@
14 14
 # - start_glusterfs
15 15
 # - configure_cinder_backend_glusterfs
16 16
 # - configure_glance_backend_glusterfs
17
+# - configure_nova_backend_glusterfs
17 18
 # - stop_glusterfs
18 19
 # - cleanup_glusterfs
19 20
 
@@ -26,10 +27,13 @@ CONFIGURE_GLUSTERFS_CINDER=${CONFIGURE_GLUSTERFS_CINDER:-True}
26 27
 # Set CONFIGURE_GLUSTERFS_GLANCE to true, to configure GlusterFS as a backend for Glance.
27 28
 CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-False}
28 29
 
29
-# Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for cinder.
30
-if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ]; then
31
-    echo "GlusterFS plugin enabled but not selected as a backend for Cinder or Glance."
32
-    echo "Please set CONFIGURE_GLUSTERFS_CINDER and/or CONFIGURE_GLUSTERFS_GLANCE to True in localrc."
30
+# Set CONFIGURE_GLUSTERFS_NOVA to true, to configure GlusterFS as a backend for Nova.
31
+CONFIGURE_GLUSTERFS_NOVA=${CONFIGURE_GLUSTERFS_NOVA:-False}
32
+
33
+# Error out when devstack-plugin-glusterfs is enabled, but not selected as a backend for Cinder, Glance or Nova.
34
+if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ];  then
35
+    echo "GlusterFS plugin enabled but not selected as a backend for Cinder, Glance or Nova."
36
+    echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_GLANCE and/or CONFIGURE_GLUSTERFS_NOVA to True in localrc."
33 37
     exit 1
34 38
 fi
35 39
 
@@ -74,6 +78,9 @@ CINDER_GLUSTERFS_SHARES=${CINDER_GLUSTERFS_SHARES:-"127.0.0.1:/cinder-vol"}
74 78
 # Glance GlusterFS share
75 79
 GLANCE_GLUSTERFS_SHARE=${GLANCE_GLUSTERFS_SHARE:-"127.0.0.1:/glance-vol"}
76 80
 
81
+# Glance Nova share
82
+NOVA_GLUSTERFS_SHARE=${NOVA_GLUSTERFS_SHARE:-"127.0.0.1:/nova-vol"}
83
+
77 84
 # Adding GlusterFS repo to CentOS / RHEL 7 platform.
78 85
 GLUSTERFS_CENTOS_REPO=${GLUSTERFS_CENTOS_REPO:-"http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo"}
79 86
 
@@ -88,6 +95,10 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
88 95
         echo_summary "Configuring GlusterFS as a backend for Glance"
89 96
         configure_glance_backend_glusterfs
90 97
     fi
98
+    if is_service_enabled nova && [[ "$CONFIGURE_GLUSTERFS_NOVA" == "True" ]]; then
99
+        echo_summary "Configuring GlusterFS as a backend for Nova"
100
+        configure_nova_backend_glusterfs
101
+    fi
91 102
 fi
92 103
 
93 104
 if [[ "$1" == "unstack" ]]; then

+ 3
- 0
devstack/settings View File

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

Loading…
Cancel
Save