Skip to content

Commit

Permalink
ceph-volume: retry when 'vagrant up' fails
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 2c88e70)
  • Loading branch information
andrewschoen authored and Alfredo Deza committed Aug 29, 2018
1 parent 061298c commit fadf12d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ceph-volume/ceph_volume/tests/functional/batch/tox.ini
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/ceph-volume/ceph_volume/tests/functional/lvm/tox.ini
Expand Up @@ -8,6 +8,7 @@ whitelist_externals =
bash
git
cp
sleep
passenv=*
setenv=
ANSIBLE_SSH_ARGS = -F {changedir}/vagrant_ssh_config
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions 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
Expand Up @@ -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
Expand Down

0 comments on commit fadf12d

Please sign in to comment.