RFC: fix(cleanup): neutron
Change-Id: I371da6b47ca6ef31c2909302b0aa71040f8930d9 Signed-off-by: Tin <tin@irrational.io>
This commit is contained in:
parent
81884d8a60
commit
5dd018ecbe
@ -822,14 +822,42 @@ conf:
|
|||||||
force_project_purge: false
|
force_project_purge: false
|
||||||
run_tempest: false
|
run_tempest: false
|
||||||
clean_up: |
|
clean_up: |
|
||||||
ROUTERS=$(openstack router list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
|
# NOTE: We will make the best effort to clean up rally generated networks and routers,
|
||||||
if [ -n "$ROUTERS" ]; then
|
# but should not block further automated deployment.
|
||||||
echo $ROUTERS | xargs openstack router delete
|
set +e
|
||||||
fi
|
PATTERN="^[sc]_rally_"
|
||||||
NETWORKS=$(openstack network list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
|
|
||||||
if [ -n "$NETWORKS" ]; then
|
ROUTERS=$(openstack router list --format=value -c Name | grep -e $PATTERN | sort | tr -d '\r')
|
||||||
echo $NETWORKS | xargs openstack network delete
|
NETWORKS=$(openstack network list --format=value -c Name | grep -e $PATTERN | sort | tr -d '\r')
|
||||||
fi
|
|
||||||
|
for ROUTER in $ROUTERS
|
||||||
|
do
|
||||||
|
openstack router unset --external-gateway $ROUTER
|
||||||
|
openstack router set --disable --no-ha $ROUTER
|
||||||
|
|
||||||
|
SUBNS=$(openstack router show $ROUTER -c interfaces_info --format=value | jq .[].subnet_id | tr -d '\r\"')
|
||||||
|
for SUBN in $SUBNS
|
||||||
|
do
|
||||||
|
openstack router remove subnet $ROUTER $SUBN
|
||||||
|
done
|
||||||
|
|
||||||
|
for PORT in $(openstack port list --router $ROUTER --format=value -c ID | tr -d '\r')
|
||||||
|
do
|
||||||
|
openstack router remove port $ROUTER $PORT
|
||||||
|
done
|
||||||
|
|
||||||
|
openstack router delete $ROUTER
|
||||||
|
done
|
||||||
|
|
||||||
|
for NETWORK in $NETWORKS
|
||||||
|
do
|
||||||
|
for PORT in $(openstack port list --network $NETWORK --format=value -c ID | tr -d '\r')
|
||||||
|
do
|
||||||
|
openstack port delete $PORT
|
||||||
|
done
|
||||||
|
openstack network delete $NETWORK
|
||||||
|
done
|
||||||
|
set -e
|
||||||
tests:
|
tests:
|
||||||
NeutronNetworks.create_and_delete_networks:
|
NeutronNetworks.create_and_delete_networks:
|
||||||
- args:
|
- args:
|
||||||
|
Loading…
Reference in New Issue
Block a user