X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fcommon-functions.sh;h=f16a93a0ea52f4deb90cbb5c73434de55386a045;hb=0160941cc7e69c77e4f675f75a80e2cf59703284;hp=ccea7fcf1e34397ef7008b84673111e78105873d;hpb=06e0024cee0d193020ad2b5dfd0eea49ab2fcbeb;p=releng%2Fbuilder.git diff --git a/jjb/integration/common-functions.sh b/jjb/integration/common-functions.sh index ccea7fcf1..f16a93a0e 100644 --- a/jjb/integration/common-functions.sh +++ b/jjb/integration/common-functions.sh @@ -10,7 +10,7 @@ export FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg export CUSTOMPROP=/tmp/${BUNDLEFOLDER}/etc/custom.properties export LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg export MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv -export CONTROLLERMEM="2048m" +export CONTROLLERMEM=${CONTROLLERMAXMEM} # Cluster specific configuration settings export AKKACONF=/tmp/${BUNDLEFOLDER}/configuration/initial/akka.conf @@ -83,10 +83,8 @@ function configure_karaf_log() { echo "Configuring the karaf log... karaf_version: ${karaf_version}, logapi: ${logapi}" if [ "${logapi}" == "log4j2" ]; then # FIXME: Make log size limit configurable from build parameter. - # From Neon the default karaf file size is 64 MB + # Increase default log file size to 1GB sed -ie 's/log4j2.appender.rolling.policies.size.size = 64MB/log4j2.appender.rolling.policies.size.size = 1GB/g' "${LOGCONF}" - # Flourine still uses 16 MB - sed -ie 's/log4j2.appender.rolling.policies.size.size = 16MB/log4j2.appender.rolling.policies.size.size = 1GB/g' "${LOGCONF}" orgmodule="org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver" orgmodule_="${orgmodule//./_}" echo "${logapi}.logger.${orgmodule_}.name = WARN" >> "${LOGCONF}" @@ -223,6 +221,11 @@ function get_test_suites() { testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}" fi + if [ "${ELASTICSEARCHATTRIBUTE}" != "disabled" ]; then + add_test="integration/test/csit/suites/integration/Create_JVM_Plots.robot" + echo "${add_test}" >> "$testplan_filepath" + fi + echo "Changing the testplan path..." sed "s:integration:${WORKSPACE}:" "${testplan_filepath}" > testplan.txt cat testplan.txt @@ -282,6 +285,125 @@ function run_plan() { printf "Finished running %s plans\\n" "${type}" } # function run_plan() +# Run scripts to support JVM monitoring. +function add_jvm_support() +{ + if [ "${ELASTICSEARCHATTRIBUTE}" != "disabled" ]; then + set_elasticsearch_attribute "${ELASTICSEARCHATTRIBUTE}" + set_jvm_common_attribute + fi +} # function add_jvm_support() + +#Expected input parameter: long/short/a number +function set_elasticsearch_attribute() +{ +short=5000 +long=120000 +default=$short + +case $1 in +short) + period=$short + ;; +long) + period=$long + ;; +*) + # shellcheck disable=SC2166 + if [[ "$1" =~ ^[0-9]+$ ]] && [ "$1" -ge $short -a "$1" -le $long ]; then + period=$1 + else + period=$default + fi + ;; +esac + +cat > "${WORKSPACE}"/org.apache.karaf.decanter.scheduler.simple.cfg < "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-local.cfg < "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-others.cfg < "${WORKSPACE}"/elasticsearch.yml < "${WORKSPACE}"/elasticsearch_startup.sh < /dev/null 2>&1 & + ls -al /tmp/elasticsearch/elasticsearch-1.7.5/bin/elasticsearch + +EOF + echo "Setup ODL_SYSTEM_IP specific config files for ${!CONTROLLERIP} " + cat "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-local.cfg + cat "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-others.cfg + cat "${WORKSPACE}"/elasticsearch.yml + + + echo "Copying config files to ${!CONTROLLERIP}" + scp "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-local.cfg "${!CONTROLLERIP}":/tmp/"${BUNDLEFOLDER}"/etc/ + scp "${WORKSPACE}"/org.apache.karaf.decanter.collector.jmx-others.cfg "${!CONTROLLERIP}":/tmp/"${BUNDLEFOLDER}"/etc/ + scp "${WORKSPACE}"/elasticsearch.yml "${!CONTROLLERIP}":/tmp/ + + ssh "${!CONTROLLERIP}" "sudo ls -al /tmp/elasticsearch/" + ssh "${!CONTROLLERIP}" "sudo mv /tmp/elasticsearch.yml /tmp/elasticsearch/elasticsearch-1.7.5/config/" + ssh "${!CONTROLLERIP}" "cat /tmp/elasticsearch/elasticsearch-1.7.5/config/elasticsearch.yml" + + echo "Copying the elasticsearch_startup script to ${!CONTROLLERIP}" + cat "${WORKSPACE}"/elasticsearch_startup.sh + scp "${WORKSPACE}"/elasticsearch_startup.sh "${!CONTROLLERIP}":/tmp + ssh "${!CONTROLLERIP}" 'bash /tmp/elasticsearch_startup.sh' + ssh "${!CONTROLLERIP}" 'ps aux | grep elasticsearch' +done +} #function set_jvm_common_attribute + # Return elapsed time. Usage: # - Call first time with no arguments and a new timer is returned. # - Next call with the first argument as the timer and the elapsed time is returned. @@ -340,6 +462,7 @@ DISTROSTREAM: ${DISTROSTREAM} BUNDLE_URL: ${BUNDLE_URL} CONTROLLERFEATURES: ${CONTROLLERFEATURES} CONTROLLERDEBUGMAP: ${CONTROLLERDEBUGMAP} +CONTROLLERMAXMEM: ${CONTROLLERMAXMEM} SCRIPTPLAN: ${SCRIPTPLAN} CONFIGPLAN: ${CONFIGPLAN} STREAMTESTPLAN: ${STREAMTESTPLAN} @@ -372,6 +495,7 @@ CREATE_INITIAL_NETWORKS: ${CREATE_INITIAL_NETWORKS} LBAAS_SERVICE_PROVIDER: ${LBAAS_SERVICE_PROVIDER} ODL_SFC_DRIVER: ${ODL_SFC_DRIVER} ODL_SNAT_MODE: ${ODL_SNAT_MODE} +GROUP_ADD_MOD_ENABLED: ${GROUP_ADD_MOD_ENABLED} EOF } @@ -547,7 +671,7 @@ EOF echo "collect_logs: for opendaylight controller ip: ${!CONTROLLERIP}" NODE_FOLDER="odl_${i}" mkdir -p "${NODE_FOLDER}" - echo "Lets's take the karaf thread dump again..." + echo "Let's take the karaf thread dump again..." ssh "${!CONTROLLERIP}" "sudo ps aux" > "${WORKSPACE}"/ps_after.log pid=$(grep org.apache.karaf.main.Main "${WORKSPACE}"/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" @@ -733,11 +857,21 @@ function get_nodes_list() { function get_features() { if [ "${CONTROLLERSCOPE}" == 'all' ]; then ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}" - export CONTROLLERMEM="3072m" + # if CONTROLLERMEM still is the default 2G and was not overridden by a + # custom job, then we need to make sure to increase it because "all" + # features can be heavy + if [ "${CONTROLLERMEM}" == "2048m" ]; then + export CONTROLLERMEM="3072m" + fi else ACTUALFEATURES="odl-infrautils-ready,${CONTROLLERFEATURES}" fi + if [ "${ELASTICSEARCHATTRIBUTE}" != "disabled" ]; then + # Add decanter features to allow JVM monitoring + ACTUALFEATURES="${ACTUALFEATURES},decanter-collector-jmx,decanter-appender-elasticsearch-rest" + fi + # Some versions of jenkins job builder result in feature list containing spaces # and ending in newline. Remove all that. ACTUALFEATURES=$(echo "${ACTUALFEATURES}" | tr -d '\n \r') @@ -782,7 +916,7 @@ if [[ "$KARAF_VERSION" == "karaf4" ]]; then FEATURE_TEST_STRING="features-test" fi -sed -ie "s%\\(featuresRepositories=\\|featuresRepositories =\\)%featuresRepositories = mvn:org.opendaylight.integration/\${FEATURE_TEST_STRING}/${BUNDLE_VERSION}/xml/features,mvn:org.apache.karaf.decanter/apache-karaf-decanter/1.0.0/xml/features,%g" ${FEATURESCONF} +sed -ie "s%\\(featuresRepositories=\\|featuresRepositories =\\)%featuresRepositories = mvn:org.opendaylight.integration/\${FEATURE_TEST_STRING}/${BUNDLE_VERSION}/xml/features,mvn:org.apache.karaf.decanter/apache-karaf-decanter/1.2.0/xml/features,%g" ${FEATURESCONF} if [[ ! -z "${REPO_URL}" ]]; then sed -ie "s%featuresRepositories =%featuresRepositories = ${REPO_URL},%g" ${FEATURESCONF} fi @@ -835,7 +969,7 @@ function create_post_startup_script() { # wait up to 60s for karaf port 8101 to be opened, polling every 5s loop_count=0; until [[ \$loop_count -ge 12 ]]; do - netstat -na | grep 8101 && break; + netstat -na | grep ":::8101" && break; loop_count=\$[\$loop_count+1]; sleep 5; done @@ -847,7 +981,7 @@ sshpass -p karaf ssh -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ -o LogLevel=error \ -p 8101 karaf@localhost \ - "bundle:refresh org.apache.karaf.decanter.collector.jmx && bundle:refresh org.apache.karaf.decanter.appender.elasticsearch" + "bundle:refresh org.apache.karaf.decanter.collector.jmx && bundle:refresh org.apache.karaf.decanter.api" if [[ "$USEFEATURESBOOT" != "True" ]]; then @@ -880,7 +1014,7 @@ done; # if we ended up not finding ready status in the above loop, we can output some debugs grep 'org.opendaylight.infrautils.*System ready' /tmp/${BUNDLEFOLDER}/data/log/karaf.log -if [ $? -ne 0 ]; then +if [ \$? -ne 0 ]; then echo "Timeout Controller DOWN" echo "Dumping first 500K bytes of karaf log..." head --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" @@ -953,7 +1087,7 @@ function copy_and_run_post_startup_script() { function dump_controller_threads() { for i in $(seq 1 "${NUM_ODL_SYSTEM}"); do CONTROLLERIP="ODL_SYSTEM_${i}_IP" - echo "Lets's take the karaf thread dump" + echo "Let's take the karaf thread dump" ssh "${!CONTROLLERIP}" "sudo ps aux" > "${WORKSPACE}"/ps_before.log pid=$(grep org.apache.karaf.main.Main "${WORKSPACE}"/ps_before.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"