From 3ac1ea85b16cfd5c0d88d3575fc5453cc5dea7c2 Mon Sep 17 00:00:00 2001 From: bkopilov Date: Mon, 6 Jun 2016 16:00:48 +0300 Subject: [PATCH] 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 --- lib/tempest | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/tempest b/lib/tempest index aa09e9a39f..501480c7d9 100644 --- a/lib/tempest +++ b/lib/tempest @@ -462,15 +462,26 @@ function configure_tempest { fi # Using ``CINDER_ENABLED_BACKENDS`` + # Cinder uses a comma separated list with "type:backend_name": + # CINDER_ENABLED_BACKENDS = ceph:cephBE1,lvm:lvmBE2,foo:my_foo if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then + # We have at least 2 backends iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True" - local i=1 + local add_comma_seperator=0 + local backends_list='' local be + # Tempest uses a comma separated list of backend_names: + # backend_names = BACKEND_1,BACKEND_2 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do - local be_name=${be##*:} - iniset $TEMPEST_CONFIG volume "backend${i}_name" "$be_name" - i=$(( i + 1 )) + if [ "$add_comma_seperator" -eq "1" ]; then + backends_list+=,${be##*:} + else + # first element in the list + backends_list+=${be##*:} + add_comma_seperator=1 + fi done + iniset $TEMPEST_CONFIG volume "backend_names" "$backends_list" fi if [ $TEMPEST_VOLUME_DRIVER != "default" -o \