Browse Source

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

This patch enables GlusterFS as a backend for Manila. This
patch also introduces two new configuration parameters:
 * CONFIGURE_GLUSTERFS_MANILA - set to 'True', to enable GlusterFS
as a backend for Manila.
 * GLUSTERFS_MANILA_DRIVER_TYPE - set Manila GlusterFS backend type
to either 'glusterfs' or 'glusterfs-native'.

Change-Id: I53e5b9e88b6ebc131c64dabc421875c06a3fafd4
Bharat Kumar Kobagana 3 years ago
parent
commit
b3c21638ac
4 changed files with 166 additions and 3 deletions
  1. 21
    0
      devstack/gluster-functions.sh
  2. 14
    3
      devstack/plugin.sh
  3. 81
    0
      devstack/post_test_hook.sh
  4. 50
    0
      devstack/pre_test_hook.sh

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

@@ -192,3 +192,24 @@ function configure_nova_backend_glusterfs {
192 192
 
193 193
     _mount_gluster_volume $NOVA_INSTANCES_PATH $NOVA_GLUSTERFS_SHARE
194 194
 }
195
+
196
+# Configure GlusterFS-NFS as backend for Manila
197
+function _configure_manila_glusterfs_nfs {
198
+    #TODO(BharatK): Add script to configure GlusterFS-NFS as a backend for Manila.
199
+    echo "Need to add script to configure GlusterFS-NFS as a backend for Manila."
200
+}
201
+
202
+# Configure GlusterFS-Native as backend for Manila
203
+function _configure_manila_glusterfs_native {
204
+    #TODO(BharatK): Add script to configure GlusterFS-Native as a backend for Manila.
205
+    echo "Need to add script to configure GlusterFS-Native as a backend for Manila."
206
+}
207
+
208
+# Configure GlusterFS as a backend for Manila
209
+function configure_manila_backend_glusterfs {
210
+    if [[ "${GLUSTERFS_MANILA_DRIVER_TYPE}" == "glusterfs" ]]; then
211
+        _configure_manila_glusterfs_nfs
212
+    else
213
+        _configure_manila_glusterfs_native
214
+    fi
215
+}

+ 14
- 3
devstack/plugin.sh View File

@@ -15,6 +15,7 @@
15 15
 # - configure_cinder_backend_glusterfs
16 16
 # - configure_glance_backend_glusterfs
17 17
 # - configure_nova_backend_glusterfs
18
+# - configure_manila_backend_glusterfs
18 19
 # - stop_glusterfs
19 20
 # - cleanup_glusterfs
20 21
 
@@ -30,10 +31,16 @@ CONFIGURE_GLUSTERFS_GLANCE=${CONFIGURE_GLUSTERFS_GLANCE:-False}
30 31
 # Set CONFIGURE_GLUSTERFS_NOVA to true, to configure GlusterFS as a backend for Nova.
31 32
 CONFIGURE_GLUSTERFS_NOVA=${CONFIGURE_GLUSTERFS_NOVA:-False}
32 33
 
34
+# Set CONFIGURE_GLUSTERFS_MANILA to true, to configure GlusterFS as a backend for Manila.
35
+CONFIGURE_GLUSTERFS_MANILA=${CONFIGURE_GLUSTERFS_MANILA:-False}
36
+
37
+# Set GLUSTERFS_MANILA_DRIVER_TYPE to either 'glusterfs' or 'glusterfs-native'.
38
+GLUSTERFS_MANILA_DRIVER_TYPE=${GLUSTERFS_MANILA_DRIVER_TYPE:-glusterfs}
39
+
33 40
 # 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."
41
+if [ "$CONFIGURE_GLUSTERFS_CINDER" = "False" ] && [ "$CONFIGURE_GLUSTERFS_GLANCE" = "False" ] && [ "$CONFIGURE_GLUSTERFS_NOVA" = "False" ] && [ "$CONFIGURE_GLUSTERFS_MANILA" = "False" ];  then
42
+    echo "GlusterFS plugin enabled but not selected as a backend for Cinder, Glance, Nova or Manila."
43
+    echo "Please set CONFIGURE_GLUSTERFS_CINDER, CONFIGURE_GLUSTERFS_GLANCE, CONFIGURE_GLUSTERFS_NOVA and/or CONFIGURE_GLUSTERFS_MANILA to True in localrc."
37 44
     exit 1
38 45
 fi
39 46
 
@@ -99,6 +106,10 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
99 106
         echo_summary "Configuring GlusterFS as a backend for Nova"
100 107
         configure_nova_backend_glusterfs
101 108
     fi
109
+    if is_service_enabled manila && [[ "$CONFIGURE_GLUSTERFS_MANILA" == "True" ]]; then
110
+        echo_summary "Configuring GlusterFS as a backend for Manila"
111
+        configure_manila_backend_glusterfs
112
+    fi
102 113
 fi
103 114
 
104 115
 if [[ "$1" == "unstack" ]]; then

+ 81
- 0
devstack/post_test_hook.sh View File

@@ -0,0 +1,81 @@
1
+#!/bin/bash -xe
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+# not use this file except in compliance with the License. You may obtain
5
+# a copy of the License at
6
+#
7
+# http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+# License for the specific language governing permissions and limitations
13
+# under the License.
14
+
15
+# This script is executed inside post_test_hook function in devstack gate.
16
+
17
+sudo chown -R jenkins:stack $BASE/new/tempest
18
+sudo chown -R jenkins:stack $BASE/data/tempest
19
+sudo chmod -R o+rx $BASE/new/devstack/files
20
+
21
+# Import devstack functions 'iniset'
22
+source $BASE/new/devstack/functions
23
+
24
+
25
+
26
+if [[ "$JOB_NAME" =~ "glusterfs-native" ]]; then
27
+    local BACKEND_NAME="GLUSTERNATIVE"
28
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_protocols glusterfs
29
+    iniset $BASE/new/tempest/etc/tempest.conf share storage_protocol GLUSTERFS
30
+else
31
+    local BACKEND_NAME="GLUSTERFS"
32
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_protocols nfs
33
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_ip_rules_for_protocols nfs
34
+    iniset $BASE/new/tempest/etc/tempest.conf share storage_protocol NFS
35
+fi
36
+
37
+
38
+iniset $BASE/new/tempest/etc/tempest.conf share backend_names $BACKEND_NAME
39
+
40
+# Set two retries for CI jobs
41
+iniset $BASE/new/tempest/etc/tempest.conf share share_creation_retry_number 2
42
+
43
+# Suppress errors in cleanup of resources
44
+SUPPRESS_ERRORS=${SUPPRESS_ERRORS_IN_CLEANUP:-True}
45
+iniset $BASE/new/tempest/etc/tempest.conf share suppress_errors_in_cleanup $SUPPRESS_ERRORS
46
+
47
+
48
+# Disable multi_backend tests
49
+RUN_MANILA_MULTI_BACKEND_TESTS=${RUN_MANILA_MULTI_BACKEND_TESTS:-False}
50
+iniset $BASE/new/tempest/etc/tempest.conf share multi_backend $RUN_MANILA_MULTI_BACKEND_TESTS
51
+
52
+# Disable manage/unmanage tests
53
+RUN_MANILA_MANAGE_TESTS=${RUN_MANILA_MANAGE_TESTS:-False}
54
+iniset $BASE/new/tempest/etc/tempest.conf share run_manage_unmanage_tests $RUN_MANILA_MANAGE_TESTS
55
+
56
+# Disable extend tests
57
+RUN_MANILA_EXTEND_TESTS=${RUN_MANILA_EXTEND_TESTS:-False}
58
+iniset $BASE/new/tempest/etc/tempest.conf share run_extend_tests $RUN_MANILA_EXTEND_TESTS
59
+
60
+# Disable shrink tests
61
+RUN_MANILA_SHRINK_TESTS=${RUN_MANILA_SHRINK_TESTS:-False}
62
+iniset $BASE/new/tempest/etc/tempest.conf share run_shrink_tests $RUN_MANILA_SHRINK_TESTS
63
+
64
+# Disable multi_tenancy tests
65
+iniset $BASE/new/tempest/etc/tempest.conf share multitenancy_enabled False
66
+
67
+
68
+# let us control if we die or not
69
+set +o errexit
70
+cd $BASE/new/tempest
71
+
72
+export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-12}
73
+export MANILA_TESTS=${MANILA_TESTS:-'tempest.api.share*'}
74
+
75
+if [[ "$JOB_NAME" =~ "scenario" ]]; then
76
+    echo "Set test set to scenario only"
77
+    MANILA_TESTS='tempest.scenario.*share*'
78
+fi
79
+
80
+echo "Running tempest manila test suites"
81
+sudo -H -u jenkins tox -eall $MANILA_TESTS -- --concurrency=$MANILA_TEMPEST_CONCURRENCY

+ 50
- 0
devstack/pre_test_hook.sh View File

@@ -0,0 +1,50 @@
1
+#!/bin/bash -xe
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+# not use this file except in compliance with the License. You may obtain
5
+# a copy of the License at
6
+#
7
+# http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+# License for the specific language governing permissions and limitations
13
+# under the License.
14
+
15
+# This script is executed inside pre_test_hook function in devstack gate.
16
+
17
+localrc_path=$BASE/new/devstack/localrc
18
+echo "DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION=1" >> $localrc_path
19
+echo "API_RATE_LIMIT=False" >> $localrc_path
20
+echo "TEMPEST_SERVICES+=,manila" >> $localrc_path
21
+
22
+echo "MANILA_USE_DOWNGRADE_MIGRATIONS=True" >> $localrc_path
23
+
24
+# JOB_NAME is defined in openstack-infra/config project
25
+# used by CI/CD, where this script is intended to be used.
26
+if [[ "$JOB_NAME" =~ "multibackend" ]]; then
27
+    echo "MANILA_MULTI_BACKEND=True" >> $localrc_path
28
+else
29
+    echo "MANILA_MULTI_BACKEND=False" >> $localrc_path
30
+fi
31
+
32
+# Enabling isolated metadata in Neutron is required because
33
+# Tempest creates isolated networks and created vm's in scenario tests don't
34
+# have access to Nova Metadata service. This leads to unavailability of
35
+# created vm's in scenario tests.
36
+echo '[[post-config|$Q_DHCP_CONF_FILE]]' >> $localrc_path
37
+echo '[DEFAULT]' >> $localrc_path
38
+echo "enable_isolated_metadata=True" >> $localrc_path
39
+
40
+# Go to Tempest dir and checkout stable commit to avoid possible
41
+# incompatibilities for plugin stored in Manila repo.
42
+TEMPEST_COMMIT="489f5e62"  # 15 June, 2015
43
+cd $BASE/new/tempest
44
+git checkout $TEMPEST_COMMIT
45
+
46
+# Print current Tempest status
47
+git status
48
+
49
+# Install Manila Tempest integration
50
+cp -r $BASE/new/manila/contrib/tempest/tempest/* $BASE/new/tempest/tempest

Loading…
Cancel
Save