From d6bba83c900c7324af31914bd29b6ca7fa11dbd7 Mon Sep 17 00:00:00 2001 From: venkata anil Date: Tue, 3 Mar 2020 20:41:21 +0530 Subject: [PATCH] cleanup rally resources When there are failures, rally may not cleanup all the resources. Users can run this script manually to cleanup stale VMs and neutron resources. Change-Id: Ib545a0c0ff162be0314a623cbbfe7cb3fff4d208 --- utils/cleanup_rally_resources.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 utils/cleanup_rally_resources.sh diff --git a/utils/cleanup_rally_resources.sh b/utils/cleanup_rally_resources.sh new file mode 100755 index 000000000..355c99520 --- /dev/null +++ b/utils/cleanup_rally_resources.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set +e + +source ~/overcloudrc +for i in `openstack server list --all -c ID -f value`; do openstack server delete $i; done +for i in `openstack floating ip list -c ID -f value`; do openstack floating ip delete $i; done +for i in `openstack router list -c ID -f value`; do openstack router unset --external-gateway $i; done +for router in `openstack router list -c ID -f value`; do + subnet=`openstack router show $router -c interfaces_info -f json | jq -r '.interfaces_info[0].subnet_id'` + openstack router remove subnet $router $subnet +done +for i in `openstack router list -c ID -f value`; do openstack router delete $i; done +for i in `openstack network list -c ID -f value`; do openstack network delete $i; done