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
This commit is contained in:
Jesse Pretorius 2015-07-30 15:11:14 +01:00
parent 4e17a53952
commit 7b10c64007
5 changed files with 9 additions and 14 deletions

View File

@ -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

View File

@ -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:-''}

View File

@ -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

View File

@ -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} $@
}

View File

@ -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