From 53e5b501a50e56703396c846a571af5a6a4ec206 Mon Sep 17 00:00:00 2001 From: Stanislav Chlebec Date: Wed, 13 Nov 2019 16:33:39 +0100 Subject: [PATCH] Disable harvesting of JVM metrics via ELASTICSEARCHATTRIBUTE=disabled for netvirt jobs. The files set_elasticsearch_attribute.sh and set_jvm_common_attribute.sh which were removed from the repo integration/test were transformed into functions in jjb/integration/common-functions.sh Minor fix - fixed Connection refused message. ... unix 3 [ ] STREAM CONNECTED 18101 ssh to karaf console to do bundle refresh of decanter jmx collector ssh: connect to host localhost port 8101: Connection refused ... JIRA: INTTEST-63 Signed-off-by: Stanislav Chlebec Change-Id: If710cd4b19a988e941ebac2b0f129dbe7e15d473 --- jjb/integration/common-functions.sh | 166 ++++++++++++++++-- jjb/integration/integration-macros.yaml | 9 +- jjb/netvirt/netvirt-apex-images.yaml | 1 + .../netvirt-csit-hwvtep-openstack.yaml | 3 + jjb/netvirt/netvirt-csit-multi-apex.yaml | 1 + .../netvirt-csit-multi-openstack-upgrade.yaml | 1 + jjb/netvirt/netvirt-csit-multi-openstack.yaml | 5 + jjb/netvirt/netvirt-dependencies.yaml | 1 + jjb/netvirt/netvirt-patch-test.yaml | 1 + jjb/netvirt/netvirt.yaml | 4 + 10 files changed, 169 insertions(+), 23 deletions(-) diff --git a/jjb/integration/common-functions.sh b/jjb/integration/common-functions.sh index 143b830fe..33b3f64c6 100644 --- a/jjb/integration/common-functions.sh +++ b/jjb/integration/common-functions.sh @@ -223,9 +223,10 @@ function get_test_suites() { testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}" fi - add_test="integration/test/csit/suites/integration/Create_JVM_Plots.robot" # we should always add for preparing JVM monitoring - echo >> "$testplan_filepath" - echo "${add_test}" >> "$testplan_filepath" + 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 @@ -289,22 +290,147 @@ function run_plan() { # Run scripts to support JVM monitoring. function add_jvm_support() { - # TODO unite short and long version to one script and parametrize the input: short/long/any number - if [ "${ELASTICSEARCHATTRIBUTE}" == "short" ]; then - run_script="${WORKSPACE}/test/csit/scripts/set_elasticsearch_attribute_short.sh" - else - run_script="${WORKSPACE}/test/csit/scripts/set_elasticsearch_attribute_long.sh" + if [ "${ELASTICSEARCHATTRIBUTE}" != "disabled" ]; then + set_elasticsearch_attribute "${ELASTICSEARCHATTRIBUTE}" + #run_script="${WORKSPACE}/test/csit/scripts/set_elasticsearch_attribute.sh ${ELASTICSEARCHATTRIBUTE}" + #printf "Executing %s...\\n" "${run_script}" + ## shellcheck source=${line} disable=SC1091 + #source "${run_script}" + + set_jvm_common_attribute + #run_script="${WORKSPACE}/test/csit/scripts/set_jvm_common_attribute.sh" + #printf "Executing %s...\\n" "${run_script}" + ## shellcheck source=${line} disable=SC1091 + #source "${run_script}" fi - printf "Executing %s...\\n" "${run_script}" - # shellcheck source=${line} disable=SC1091 - source "${run_script}" - - run_script="${WORKSPACE}/test/csit/scripts/set_jvm_common_attribute.sh" - printf "Executing %s...\\n" "${run_script}" - # shellcheck source=${line} disable=SC1091 - source "${run_script}" } # 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}"/org.apache.karaf.decanter.appender.elasticsearch.cfg < "${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.appender.elasticsearch.cfg + 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.appender.elasticsearch.cfg "${!CONTROLLERIP}":/tmp/"${BUNDLEFOLDER}"/etc/ + 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. @@ -761,8 +887,10 @@ function get_features() { ACTUALFEATURES="odl-infrautils-ready,${CONTROLLERFEATURES}" fi - # Add decanter features to allow JVM monitoring - ACTUALFEATURES="${ACTUALFEATURES},decanter-collector-jmx,decanter-appender-elasticsearch" + if [ "${ELASTICSEARCHATTRIBUTE}" != "disabled" ]; then + # Add decanter features to allow JVM monitoring + ACTUALFEATURES="${ACTUALFEATURES},decanter-collector-jmx,decanter-appender-elasticsearch" + fi # Some versions of jenkins job builder result in feature list containing spaces # and ending in newline. Remove all that. @@ -861,7 +989,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 diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml index c3e90c3cd..6768e4ce6 100644 --- a/jjb/integration/integration-macros.yaml +++ b/jjb/integration/integration-macros.yaml @@ -38,7 +38,8 @@ default: '{controller-features}' description: | Features to install in the controller separated by comma - (note: extra features such as decanter are inserted in install scripts) + (note: Do not include decanter* features used for harvesting JVM metrics. + They are inserted in install scripts.) - string: name: CONTROLLERDEBUGMAP @@ -54,10 +55,10 @@ default: '{feature-elasticsearch-attribute}' description: | Configure the period the script should harvest JVM metrics. - Default is short. - Possible values: long (its value is 120000) - short (its value is 5000) + Possible values: long (=120000) + short (=5000) any number between 5000 and 120000 + disabled (use for disabling harvesting) - string: name: USEFEATURESBOOT diff --git a/jjb/netvirt/netvirt-apex-images.yaml b/jjb/netvirt/netvirt-apex-images.yaml index 4b9ebd50e..e484a9484 100644 --- a/jjb/netvirt/netvirt-apex-images.yaml +++ b/jjb/netvirt/netvirt-apex-images.yaml @@ -5,6 +5,7 @@ - 'netvirt-apex-image-management' project: 'netvirt' + elasticsearch-attribute: 'disabled' os-cloud: vex disable-job: true diff --git a/jjb/netvirt/netvirt-csit-hwvtep-openstack.yaml b/jjb/netvirt/netvirt-csit-hwvtep-openstack.yaml index 4d98bd450..36e2626ff 100644 --- a/jjb/netvirt/netvirt-csit-hwvtep-openstack.yaml +++ b/jjb/netvirt/netvirt-csit-hwvtep-openstack.yaml @@ -5,6 +5,7 @@ - inttest-csit-hwvtep-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'magnesium' branch: 'master' jre: 'openjdk11' @@ -55,6 +56,7 @@ - inttest-csit-hwvtep-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'sodium' branch: 'stable/sodium' testplan: '{project}-{topology}-l2gw-openstack.txt' @@ -104,6 +106,7 @@ - inttest-csit-hwvtep-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'neon' branch: 'stable/neon' testplan: '{project}-{topology}-l2gw-openstack.txt' diff --git a/jjb/netvirt/netvirt-csit-multi-apex.yaml b/jjb/netvirt/netvirt-csit-multi-apex.yaml index 3b23bbf1a..542bb4e48 100644 --- a/jjb/netvirt/netvirt-csit-multi-apex.yaml +++ b/jjb/netvirt/netvirt-csit-multi-apex.yaml @@ -7,6 +7,7 @@ disable-job: true project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: - magnesium: branch: 'master' diff --git a/jjb/netvirt/netvirt-csit-multi-openstack-upgrade.yaml b/jjb/netvirt/netvirt-csit-multi-openstack-upgrade.yaml index 4ed7f4ff1..e0da860e9 100644 --- a/jjb/netvirt/netvirt-csit-multi-openstack-upgrade.yaml +++ b/jjb/netvirt/netvirt-csit-multi-openstack-upgrade.yaml @@ -5,6 +5,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: - magnesium: diff --git a/jjb/netvirt/netvirt-csit-multi-openstack.yaml b/jjb/netvirt/netvirt-csit-multi-openstack.yaml index 84a1f5ed1..904d3b90b 100644 --- a/jjb/netvirt/netvirt-csit-multi-openstack.yaml +++ b/jjb/netvirt/netvirt-csit-multi-openstack.yaml @@ -5,6 +5,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'magnesium' branch: 'master' jre: 'openjdk11' @@ -94,6 +95,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'sodium' branch: 'stable/sodium' testplan: '{project}-{topology}-openstack.txt' @@ -182,6 +184,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: 'neon' branch: 'stable/neon' testplan: '{project}-{topology}-openstack.txt' @@ -260,6 +263,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' security-group-mode: 'stateful' odl_system_flavor: odl-highcpu-4 openstack_system2_flavor: odl-highcpu-8 @@ -307,6 +311,7 @@ - inttest-csit-openstack-custom project: 'netvirt' + elasticsearch-attribute: 'disabled' testplan: '{project}-{topology}-openstack.txt' odl-ml2-driver-version: 'v2' enable-openstack-services: 'n-cpu,placement-api,tempest' diff --git a/jjb/netvirt/netvirt-dependencies.yaml b/jjb/netvirt/netvirt-dependencies.yaml index db1b70c2c..7d8e9e021 100644 --- a/jjb/netvirt/netvirt-dependencies.yaml +++ b/jjb/netvirt/netvirt-dependencies.yaml @@ -3,6 +3,7 @@ name: netvirt-thirdparty-quagga-dependencies project: 'netvirt' project-name: 'netvirt' + elasticsearch-attribute: 'disabled' jobs: - 'netvirt-thirdparty-quagga-{platform}' diff --git a/jjb/netvirt/netvirt-patch-test.yaml b/jjb/netvirt/netvirt-patch-test.yaml index e141afbc2..a28c37603 100644 --- a/jjb/netvirt/netvirt-patch-test.yaml +++ b/jjb/netvirt/netvirt-patch-test.yaml @@ -5,6 +5,7 @@ - inttest-patch-test project: 'netvirt' + elasticsearch-attribute: 'disabled' stream: - magnesium: diff --git a/jjb/netvirt/netvirt.yaml b/jjb/netvirt/netvirt.yaml index 03c1962ad..76b32bc54 100644 --- a/jjb/netvirt/netvirt.yaml +++ b/jjb/netvirt/netvirt.yaml @@ -22,6 +22,7 @@ project: 'netvirt' project-name: 'netvirt' + elasticsearch-attribute: 'disabled' java-version: 'openjdk11' mvn-settings: 'netvirt-settings' @@ -63,6 +64,7 @@ project: 'netvirt' project-name: 'netvirt' + elasticsearch-attribute: 'disabled' mvn-settings: 'netvirt-settings' mvn-opts: '-Xmx2048m' build-timeout: 90 @@ -102,6 +104,7 @@ project: 'netvirt' project-name: 'netvirt' + elasticsearch-attribute: 'disabled' mvn-settings: 'netvirt-settings' mvn-opts: '-Xmx2048m' build-timeout: 90 @@ -125,6 +128,7 @@ project: 'netvirt' project-name: 'netvirt' + elasticsearch-attribute: 'disabled' branch: 'master' java-version: 'openjdk11' mvn-settings: 'netvirt-settings' -- 2.36.6