Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Single VM: Ensure no ciao network artifacts are left behind
Browse files Browse the repository at this point in the history
Ensure that no ciao network artifacts are left behind one all
instances have been deleted.

Note: Similar logic needs to be in place for storage other artifacts.

Signed-off-by: Manohar Castelino <[email protected]>
  • Loading branch information
mcastelino committed Nov 9, 2016
1 parent f7770fc commit 9b27831
Showing 1 changed file with 87 additions and 1 deletion.
88 changes: 87 additions & 1 deletion testutil/singlevm/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ else
echo "Container connectivity verified"
fi

#Clear out all prior events
"$ciao_gobin"/ciao-cli event delete

#Wait for the event count to drop to 0
retry=0
ciao_events=0

until [ $retry -ge 6 ]
do
ciao_events=`"$ciao_gobin"/ciao-cli event list | grep "0 Ciao event" | wc -l`

if [ $ciao_events -eq 1 ]
then
break
fi

let retry=retry+1
sleep 1
done

if [ $ciao_events -ne 1 ]
then
echo "FATAL ERROR: ciao events not deleted properly"
"$ciao_gobin"/ciao-cli event list
exit 1
fi

#Now delete all instances
"$ciao_gobin"/ciao-cli instance delete --all

Expand All @@ -136,4 +163,63 @@ then
fi

"$ciao_gobin"/ciao-cli instance list
"$ciao_gobin"/ciao-cli instance delete --all

#Wait for all the instance deletions to be reported back
retry=0
ciao_events=0

until [ $retry -ge 6 ]
do
ciao_events=`"$ciao_gobin"/ciao-cli event list | grep "4 Ciao event(s)" | wc -l`

if [ $ciao_events -eq 1 ]
then
break
fi

let retry=retry+1
sleep 1
done

if [ $ciao_events -ne 1 ]
then
echo "FATAL ERROR: ciao instances not deleted properly"
"$ciao_gobin"/ciao-cli event list
exit 1
fi

#Wait around a bit as instance delete is asynchronous
retry=0
ciao_networks=0
until [ $retry -ge 6 ]
do
#Verify that there are no ciao related artifacts left behind
ciao_networks=`sudo docker network ls --filter driver=ciao -q | wc -l`

if [ $ciao_networks -eq 0 ]
then
break
fi
let retry=retry+1
sleep 1
done

if [ $ciao_networks -ne 0 ]
then
echo "FATAL ERROR: ciao docker networks not cleaned up"
sudo docker network ls --filter driver=ciao
exit 1
fi


#The only ciao interfaces left behind should be CNCI VNICs
#Once we can delete tenants we should not even have them around
cnci_vnics=`ip -d link | grep alias | grep cnci | wc -l`
ciao_vnics=`ip -d link | grep alias | wc -l`

if [ $cnci_vnics -ne $ciao_vnics ]
then
echo "FATAL ERROR: ciao network interfaces not cleaned up"
ip -d link | grep alias
exit 1
fi

0 comments on commit 9b27831

Please sign in to comment.