From 7b10c64007a14e78b52b0afcfc2fa2f7b4e17ef3 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 30 Jul 2015 15:11:14 +0100 Subject: [PATCH] Change ansible forks used This patch changes the number of forks used by ansible when using any of the convenience (and thus gate check) scripts to the number of processors available on the deployment system. The previous values used were found to cause ssh connection errors and it was found that reducing the number improved the chances of success. This patch also removes the forks setting from ansible.conf so that ansible will use the default value when run in any other way. This leaves the decision of setting the number of forks to the deployer, as it should be. Change-Id: I31ad7353344f7994063127ecfce8f4733769234c Closes-Bug: #1479812 --- playbooks/ansible.cfg | 5 ----- scripts/gate-check-commit.sh | 2 -- scripts/run-playbooks.sh | 3 ++- scripts/scripts-library.sh | 7 ++++--- scripts/teardown.sh | 6 +++--- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/playbooks/ansible.cfg b/playbooks/ansible.cfg index 76a7bbae05..5c36952c7d 100644 --- a/playbooks/ansible.cfg +++ b/playbooks/ansible.cfg @@ -7,11 +7,6 @@ gathering = smart hostfile = inventory host_key_checking = False -# Setting forks should be based on your system. The Ansible defaults to 5, -# the os-lxc-hosts assumes that you have a system that can support -# OpenStack, thus it has been conservatively been set to 15 -forks = 15 - # Set color options nocolor = 0 diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 781bbf901f..f5182f235b 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -34,8 +34,6 @@ export DEPLOY_SWIFT=${DEPLOY_SWIFT:-"yes"} export DEPLOY_TEMPEST=${DEPLOY_TEMPEST:-"yes"} # Limit the gate check to only performing one attempt, unless already set export MAX_RETRIES=${MAX_RETRIES:-"2"} -# limit forks for gate check -export FORKS=${FORKS:-10} # tempest and testr options, default is to run tempest in serial export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS:-'--serial'} export TESTR_OPTS=${TESTR_OPTS:-''} diff --git a/scripts/run-playbooks.sh b/scripts/run-playbooks.sh index 8dd155d946..fb61ff3587 100755 --- a/scripts/run-playbooks.sh +++ b/scripts/run-playbooks.sh @@ -95,6 +95,7 @@ pushd "playbooks" mkdir -p "${COMMAND_LOGS}/container_net_bounce" ansible all_containers -m script \ -a '/tmp/ensure_container_networking.sh' \ + --forks ${FORKS} \ -t "${COMMAND_LOGS}/container_net_bounce" \ &> ${COMMAND_LOGS}/container_net_bounce.log @@ -105,7 +106,7 @@ pushd "playbooks" mkdir -p "${COMMAND_LOGS}/force_apt_update" ansible all_containers -m raw \ -a '(apt-get update && apt-key update) || true' \ - --forks 10 \ + --forks ${FORKS} \ -t "${COMMAND_LOGS}/force_apt_update" \ &> ${COMMAND_LOGS}/force_apt_update.log fi diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index fc9d247e95..44ec32a90d 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -20,10 +20,11 @@ LINE='----------------------------------------------------------------------' MAX_RETRIES=${MAX_RETRIES:-5} MIN_LXC_VG_SIZE_GB=${MIN_LXC_VG_SIZE_GB:-250} REPORT_DATA=${REPORT_DATA:-""} -FORKS=${FORKS:-25} ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""} STARTTIME="${STARTTIME:-$(date +%s)}" +# the number of forks is set as the number of CPU's present +FORKS=${FORKS:-$(grep -c ^processor /proc/cpuinfo)} ## Functions ----------------------------------------------------------------- # Used to retry a process that may fail due to random issues. @@ -56,8 +57,8 @@ function successerator() { } function install_bits() { - # The number of forks has been limited to 10 by default (2x ansible default) - # This will also run ansible in 3x verbose mode + # Use the successerator to run openstack-ansible with + # the appropriate number of forks successerator openstack-ansible ${ANSIBLE_PARAMETERS} --forks ${FORKS} $@ } diff --git a/scripts/teardown.sh b/scripts/teardown.sh index 79b018c12a..39fbaec156 100755 --- a/scripts/teardown.sh +++ b/scripts/teardown.sh @@ -231,10 +231,10 @@ EOF # Destroy all of the known stuff. if [ "${ANSIBLE_DESTROY_HOSTS}" == "localhost" ];then echo -e '[all]\nlocalhost ansible_connection=local' | tee /tmp/localhost - openstack-ansible -i /tmp/localhost /tmp/destroy_play.yml --forks 5 || true + openstack-ansible -i /tmp/localhost /tmp/destroy_play.yml --forks ${FORKS} || true else - openstack-ansible lxc-containers-destroy.yml --forks 5 || true - openstack-ansible /tmp/destroy_play.yml --forks 5 || true + openstack-ansible lxc-containers-destroy.yml --forks ${FORKS} || true + openstack-ansible /tmp/destroy_play.yml --forks ${FORKS} || true fi popd