]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-ansible-prs: remove old libvirt networks before running tests 690/head
authorAndrew Schoen <aschoen@redhat.com>
Tue, 25 Apr 2017 18:04:24 +0000 (13:04 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 25 Apr 2017 18:04:24 +0000 (13:04 -0500)
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 <aschoen@redhat.com>
ceph-ansible-prs/build/build

index 622b4b4dbe6a129e3a7085d027bf74276bbb30cd..7b7d4d2d44728f61e92f29fb83cc8f39fc70934d 100644 (file)
@@ -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