From 7086ff0638858d40e99055af3a16d64ea81010a5 Mon Sep 17 00:00:00 2001 From: Shaleen Saxena Date: Mon, 2 Nov 2015 16:21:34 -0500 Subject: [PATCH] Cluster configuration script should copy initial configuration files. The current version of configure_cluster.sh script needs the odl-mdsal-clustering feature to be pre-configured, so that the configuration/initial/ directory has the necessary cluster config files. This fix will copy the initial configuration files, if they do not exist currently. Also, I fixed two other issues: - The script failed to run if it was executed in the bin directory. - Some lines had tabs instead of spaces. Change-Id: Iee27a37ef681831bd4c3f8496694c52bdc1613e0 Signed-off-by: Shaleen Saxena --- .../main/assembly/bin/configure_cluster.sh | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/distributions/karaf/src/main/assembly/bin/configure_cluster.sh b/distributions/karaf/src/main/assembly/bin/configure_cluster.sh index bc837790..93140aaf 100755 --- a/distributions/karaf/src/main/assembly/bin/configure_cluster.sh +++ b/distributions/karaf/src/main/assembly/bin/configure_cluster.sh @@ -57,7 +57,7 @@ function join { final=$1; shift for str in $* ; do - final=${final}${delim}${str} + final=${final}${delim}${str} done echo ${final} @@ -126,30 +126,52 @@ function verify_configuration_files { # Constants BIN_DIR=`dirname $0` + test ${BIN_DIR} == '.' && BIN_DIR=${PWD} CONTROLLER_DIR=`dirname ${BIN_DIR}` CONF_DIR=${CONTROLLER_DIR}/configuration/initial AKKACONF=${CONF_DIR}/akka.conf MODULESCONF=${CONF_DIR}/modules.conf MODULESHARDSCONF=${CONF_DIR}/module-shards.conf - # Verify configuation files are present. + # Verify configuration files are present in expected location. if [ ! -f ${AKKACONF} -o ! -f ${MODULESHARDSCONF} ]; then - cat << EOF - ERROR: Cluster configurations files not found. Please configure\ - clustering feature. - + # Check if the configuration files exist in the system + # directory, then copy them over. + ORIG_CONF_DIR=${CONTROLLER_DIR}/system/org/opendaylight/controller/sal-clustering-config + version=$(sed -n -e 's/.*\(.*\)<\/version>/\1/p' ${ORIG_CONF_DIR}/maven-metadata-local.xml) + ORIG_CONF_DIR=${ORIG_CONF_DIR}/${version} + ORIG_AKKA_CONF=sal-clustering-config-${version}-akkaconf.xml + ORIG_MODULES_CONF=sal-clustering-config-${version}-moduleconf.xml + ORIG_MODULESHARDS_CONF=sal-clustering-config-${version}-moduleshardconf.xml + + if [ -f ${ORIG_CONF_DIR}/${ORIG_AKKA_CONF} -a \ + -f ${ORIG_CONF_DIR}/${ORIG_MODULES_CONF} -a \ + -f ${ORIG_CONF_DIR}/${ORIG_MODULESHARDS_CONF} ]; then + cat <