Fix devstack plugin custom config opt setting

Commit https://github.com/openstack/manila/commit/1a2ec3da introduced new
approach to manila configuration file setting and it won't consider custom
opts for DEFAULT group by default behaviour, only when its name added to
"MANILA_CONFIGURE_GROUPS".
We should make it set always, because DEFAULT group is used always.

Change-Id: I377d46148b8da3c26f26a51a42ae749715e396aa
Closes-Bug: #1401793
This commit is contained in:
Valeriy Ponomaryov 2014-12-12 17:42:50 +02:00
parent 1a2ec3da9b
commit f417e25ebc

View File

@ -30,6 +30,7 @@
# drivers. By default they are equal. Also be attentive, if you modify both, # drivers. By default they are equal. Also be attentive, if you modify both,
# make sure 'MANILA_CONFIGURE_GROUPS' contains all values from # make sure 'MANILA_CONFIGURE_GROUPS' contains all values from
# 'MANILA_ENABLED_BACKENDS'. # 'MANILA_ENABLED_BACKENDS'.
# DEFAULT group is always defined, no need to specify it within 'MANILA_CONFIGURE_GROUPS'.
# #
# 3) Two default backends are used for compatibility with previous approach. # 3) Two default backends are used for compatibility with previous approach.
# They have same configuration except name of backend. Both use generic driver. # They have same configuration except name of backend. Both use generic driver.
@ -143,6 +144,24 @@ function configure_default_backends {
done done
} }
function set_config_opts {
# expects only one param - name of config group(s) as list separated by commas
GROUP_NAMES=$1
if [[ -n "$GROUP_NAMES" ]]; then
for be in ${GROUP_NAMES//,/ }; do
# get backend_specific opt values
prefix=MANILA_OPTGROUP_$be\_
( set -o posix ; set ) | grep ^$prefix | while read -r line ; do
# parse it to opt names and values
opt=${line#$prefix}
opt_name=${opt%%=*}
opt_value=${opt##*=}
iniset $MANILA_CONF $be $opt_name $opt_value
done
done
fi
}
# configure_manila - Set config files, create data dirs, etc # configure_manila - Set config files, create data dirs, etc
function configure_manila { function configure_manila {
setup_develop $MANILA_DIR setup_develop $MANILA_DIR
@ -254,19 +273,8 @@ function configure_manila {
fi fi
MANILA_CONFIGURE_GROUPS=${MANILA_CONFIGURE_GROUPS:-"$MANILA_ENABLED_BACKENDS"} MANILA_CONFIGURE_GROUPS=${MANILA_CONFIGURE_GROUPS:-"$MANILA_ENABLED_BACKENDS"}
if [[ -n "$MANILA_CONFIGURE_GROUPS" ]]; then set_config_opts $MANILA_CONFIGURE_GROUPS
for be in ${MANILA_CONFIGURE_GROUPS//,/ }; do set_config_opts DEFAULT
# get backend_specific opt values
prefix=MANILA_OPTGROUP_$be\_
compgen -v | grep $prefix | while read -r line ; do
# parse it to opt names and values
opt=${line#$prefix}
opt_name=${opt%%=*}
opt_value=${opt##*=}
iniset $MANILA_CONF $be $opt_name $opt_value
done
done
fi
} }
function create_manila_service_flavor { function create_manila_service_flavor {