Browse Source

Merge "Configure Manila with glusterfs_native driver"

Jenkins 3 years ago
parent
commit
b52022d3e1
1 changed files with 63 additions and 3 deletions
  1. 63
    3
      devstack/gluster-functions.sh

+ 63
- 3
devstack/gluster-functions.sh View File

@@ -259,10 +259,70 @@ function _configure_manila_glusterfs_nfs {
259 259
     iniset $MANILA_CONF DEFAULT enabled_share_backends $MANILA_ENABLED_BACKENDS
260 260
 }
261 261
 
262
-# Configure glusterfsnative.py as backend driver for Manila
262
+
263
+# Create necessary files required to support GlusterFS's TLS feature for the
264
+# GlusterFS server running on the local host.
265
+# Require a common name for the signed certificate that the function creates to
266
+# be passed as a parameter.
267
+function _configure_glusterfs_server_in_local_host_for_tls_support {
268
+
269
+    local common_name=$1
270
+
271
+    # Generate a private key.
272
+    sudo openssl genrsa -out /etc/ssl/glusterfs.key 2048
273
+
274
+    # Generate self-signed certicate with the common name passed to the
275
+    # function.
276
+    sudo openssl req -new -x509 -key /etc/ssl/glusterfs.key -subj /CN=$common_name -out /etc/ssl/glusterfs.pem
277
+
278
+    # Create certificate authority file.
279
+    sudo cp /etc/ssl/glusterfs.pem /etc/ssl/glusterfs.ca
280
+
281
+}
282
+
283
+# Setup and configure glusterfs_native.py as the backend share driver for Manila
263 284
 function _configure_manila_glusterfs_native {
264
-    #TODO(BharatK): Add script to configure GlusterFS-Native as a backend for Manila.
265
-    echo "Need to add script to configure GlusterFS-Native as a backend for Manila."
285
+
286
+
287
+    # Create necessary files to allow GlusterFS volumes to use TLS features
288
+    local common_name=server.com
289
+    _configure_glusterfs_server_in_local_host_for_tls_support $common_name
290
+
291
+    # Create four GlusterFS volumes to be used as shares.
292
+    _create_thin_lv_pool
293
+
294
+    for i in `seq 1 20`; do
295
+        _create_thin_lv_gluster_vol manila-glusterfs-native-vol-20G-$i 20G
296
+        # Configure the volume to use GlusterFS's TLS support required by the
297
+        # native driver.
298
+        sudo gluster vol set manila-glusterfs-native-vol-20G-$i auth.ssl-allow $common_name
299
+    done
300
+
301
+    # Configure manila.conf.
302
+    local share_driver=manila.share.drivers.glusterfs_native.GlusterfsNativeShareDriver
303
+    local group_name=glusternative1
304
+    # Set "glusterfs_volume_pattern" option to be
305
+    # "manila-glusterfs-native-vol-#{size}G-\d+$".
306
+    local glusterfs_volume_pattern=manila-glusterfs-native-vol-#{size}G-\\\\d+$
307
+
308
+    iniset $MANILA_CONF $group_name share_driver $share_driver
309
+    iniset $MANILA_CONF $group_name share_backend_name GLUSTERFSNATIVE
310
+    iniset $MANILA_CONF $group_name glusterfs_servers $(hostname)
311
+    iniset $MANILA_CONF $group_name driver_handles_share_servers False
312
+    iniset $MANILA_CONF $group_name glusterfs_volume_pattern $glusterfs_volume_pattern
313
+
314
+    # Set enabled_share_protocols to be GLUSTERFS that is used by
315
+    # glusterfs_native driver.
316
+    iniset $MANILA_CONF DEFAULT enabled_share_protocols GLUSTERFS
317
+
318
+
319
+    # Override MANILA_ENABLED_BACKENDS used in manila's devstack plugin.
320
+    # This allows glusternative1 to be recognized as the enabled backend for
321
+    # manila in the stack.sh run.
322
+    MANILA_ENABLED_BACKENDS=$group_name
323
+
324
+    # Set enabled_share_backends
325
+    iniset $MANILA_CONF DEFAULT enabled_share_backends $group_name
266 326
 }
267 327
 
268 328
 # Configure GlusterFS as a backend for Manila

Loading…
Cancel
Save