Merge "RFC: fix(cleanup): neutron"
This commit is contained in:
commit
84b27c895d
@ -822,14 +822,42 @@ conf:
|
||||
force_project_purge: false
|
||||
run_tempest: false
|
||||
clean_up: |
|
||||
ROUTERS=$(openstack router list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
|
||||
if [ -n "$ROUTERS" ]; then
|
||||
echo $ROUTERS | xargs openstack router delete
|
||||
fi
|
||||
NETWORKS=$(openstack network list -f value | awk '$2 ~ /^[sc]_rally_/ { print $1 }')
|
||||
if [ -n "$NETWORKS" ]; then
|
||||
echo $NETWORKS | xargs openstack network delete
|
||||
fi
|
||||
# NOTE: We will make the best effort to clean up rally generated networks and routers,
|
||||
# but should not block further automated deployment.
|
||||
set +e
|
||||
PATTERN="^[sc]_rally_"
|
||||
|
||||
ROUTERS=$(openstack router list --format=value -c Name | grep -e $PATTERN | sort | tr -d '\r')
|
||||
NETWORKS=$(openstack network list --format=value -c Name | grep -e $PATTERN | sort | tr -d '\r')
|
||||
|
||||
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:
|
||||
NeutronNetworks.create_and_delete_networks:
|
||||
- args:
|
||||
|
Loading…
Reference in New Issue
Block a user