Skip to content

Commit

Permalink
Change ansible forks used
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jesse Pretorius committed Jul 30, 2015
1 parent 4e17a53 commit 7b10c64
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions playbooks/ansible.cfg
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions scripts/gate-check-commit.sh
Expand Up @@ -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:-''}
Expand Down
3 changes: 2 additions & 1 deletion scripts/run-playbooks.sh
Expand Up @@ -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

Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions scripts/scripts-library.sh
Expand Up @@ -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.
Expand Down Expand Up @@ -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} $@
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/teardown.sh
Expand Up @@ -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

Expand Down

0 comments on commit 7b10c64

Please sign in to comment.