Browse code

Add a multibackend list to tempest.conf

A change was made to tempest.conf for volume multibackend. Previously,
tempest used the following, with a limit of 2 backends:
backend1_name = BACKEND1
backend2_name = BACKEND2
That was changed to accomodate >2 backends. tempest.conf now uses a comma
separated list:
backend_names=BACKEND1,BACKEND2,BACKEND3

devstack/lib/cinder uses a comma separated list with "type:backend_name":
enabled_backends = lvm:BACKEND1,ceph:BACKEND2
This is in order to use scripts in devstack/lib/cinder_backends to setup
devstack basked on "type".

This patch allows parsing of the CINDER_ENABLED_BACKENDS to pass the proper
backend_name to tempest.

Change-Id: I76973c3fad4998a0f9e534fc9f6a271c1923f7b3

bkopilov authored on 2016/06/06 22:00:48
Showing 1 changed files
... ...
@@ -462,15 +462,26 @@ function configure_tempest {
462 462
     fi
463 463
 
464 464
     # Using ``CINDER_ENABLED_BACKENDS``
465
+    # Cinder uses a comma separated list with "type:backend_name":
466
+    #  CINDER_ENABLED_BACKENDS = ceph:cephBE1,lvm:lvmBE2,foo:my_foo
465 467
     if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
468
+        # We have at least 2 backends
466 469
         iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
467
-        local i=1
470
+        local add_comma_seperator=0
471
+        local backends_list=''
468 472
         local be
473
+        # Tempest uses a comma separated list of backend_names:
474
+        #   backend_names = BACKEND_1,BACKEND_2
469 475
         for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
470
-            local be_name=${be##*:}
471
-            iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name"
472
-            i=$(( i + 1 ))
476
+            if [ "$add_comma_seperator" -eq "1" ]; then
477
+                backends_list+=,${be##*:}
478
+            else
479
+            # first element in the list
480
+                backends_list+=${be##*:}
481
+                add_comma_seperator=1
482
+            fi
473 483
         done
484
+        iniset $TEMPEST_CONFIG volume "backend_names" "$backends_list"
474 485
     fi
475 486
 
476 487
     if [ $TEMPEST_VOLUME_DRIVER != "default" -o \