From 2c88e70877dcc2a04a69be4ab9c4834d5ced6198 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 22 Aug 2018 16:37:46 -0400 Subject: [PATCH] ceph-volume: retry when 'vagrant up' fails Signed-off-by: Andrew Schoen --- .../ceph_volume/tests/functional/batch/tox.ini | 2 +- .../ceph_volume/tests/functional/lvm/tox.ini | 3 ++- .../tests/functional/scripts/vagrant_up.sh | 12 ++++++++++++ .../ceph_volume/tests/functional/simple/tox.ini | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/ceph-volume/ceph_volume/tests/functional/scripts/vagrant_up.sh diff --git a/src/ceph-volume/ceph_volume/tests/functional/batch/tox.ini b/src/ceph-volume/ceph_volume/tests/functional/batch/tox.ini index 37a9c1819ab3e..6a43a110e47eb 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/batch/tox.ini +++ b/src/ceph-volume/ceph_volume/tests/functional/batch/tox.ini @@ -34,7 +34,7 @@ changedir= commands= git clone -b {env:CEPH_ANSIBLE_BRANCH:master} --single-branch https://github.com/ceph/ceph-ansible.git {envdir}/tmp/ceph-ansible - vagrant up {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} + bash {toxinidir}/../scripts/vagrant_up.sh {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} bash {toxinidir}/../scripts/generate_ssh_config.sh {changedir} cp {toxinidir}/../playbooks/deploy.yml {envdir}/tmp/ceph-ansible diff --git a/src/ceph-volume/ceph_volume/tests/functional/lvm/tox.ini b/src/ceph-volume/ceph_volume/tests/functional/lvm/tox.ini index 97f5d51a39ed5..d9f325543cd90 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/lvm/tox.ini +++ b/src/ceph-volume/ceph_volume/tests/functional/lvm/tox.ini @@ -8,6 +8,7 @@ whitelist_externals = bash git cp + sleep passenv=* setenv= ANSIBLE_SSH_ARGS = -F {changedir}/vagrant_ssh_config @@ -45,7 +46,7 @@ commands= # but the master branch doesn't pin dependencies so we can't guarantee to work correctly #pip install -r {envdir}/tmp/ceph-ansible/requirements.txt - vagrant up {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} + bash {toxinidir}/../scripts/vagrant_up.sh {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} bash {toxinidir}/../scripts/generate_ssh_config.sh {changedir} # create logical volumes to test with on the vms diff --git a/src/ceph-volume/ceph_volume/tests/functional/scripts/vagrant_up.sh b/src/ceph-volume/ceph_volume/tests/functional/scripts/vagrant_up.sh new file mode 100644 index 0000000000000..2f9a15f84a49c --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/functional/scripts/vagrant_up.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +retries=0 +until [ $retries -ge 5 ] +do + echo "Attempting to start VMs. Attempts: $retries" + timeout 10m vagrant up "$@" && break + retries=$[$retries+1] + sleep 5 +done + +sleep 10 diff --git a/src/ceph-volume/ceph_volume/tests/functional/simple/tox.ini b/src/ceph-volume/ceph_volume/tests/functional/simple/tox.ini index 632cbb02f2f5e..5f506badc499d 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/simple/tox.ini +++ b/src/ceph-volume/ceph_volume/tests/functional/simple/tox.ini @@ -42,7 +42,7 @@ commands= # but the master branch doesn't pin dependencies so we can't guarantee to work correctly #pip install -r {envdir}/tmp/ceph-ansible/requirements.txt - vagrant up {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} + bash {toxinidir}/../scripts/vagrant_up.sh {env:VAGRANT_UP_FLAGS:"--no-provision"} {posargs:--provider=virtualbox} bash {toxinidir}/../scripts/generate_ssh_config.sh {changedir} cp {toxinidir}/../playbooks/deploy.yml {envdir}/tmp/ceph-ansible -- 2.39.5