From: Andrew Schoen Date: Tue, 25 Apr 2017 18:04:24 +0000 (-0500) Subject: ceph-ansible-prs: remove old libvirt networks before running tests X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6846e2edca4fef8075a0a034ceeecede41e7ea95;p=ceph-build.git ceph-ansible-prs: remove old libvirt networks before running tests Occasionally we deal with libvirt network issues on jenkins slaves that have been used for a couple test runs, this attempts to avoid those. Signed-off-by: Andrew Schoen --- diff --git a/ceph-ansible-prs/build/build b/ceph-ansible-prs/build/build index 622b4b4d..7b7d4d2d 100644 --- a/ceph-ansible-prs/build/build +++ b/ceph-ansible-prs/build/build @@ -9,6 +9,13 @@ source $VENV/activate WORKDIR=$(mktemp -td tox.XXXXXXXXXX) +# Sometimes, networks may linger around, so we must ensure they are killed: +networks=`sudo virsh net-list --all | grep active | egrep -v "(default|libvirt)" | cut -d ' ' -f 2` +for network in $networks; do + sudo virsh net-destroy $network || true + sudo virsh net-undefine $network || true +done + # the $SCENARIO var is injected by the job template. It maps # to an actual, defined, tox environment $VENV/tox -rv -e=$RELEASE-$SCENARIO --workdir=$WORKDIR -- --provider=libvirt