OpenStack Stein删除所有网络

#!/bin/bash
#delete vm

for vim  in `nova list |awk '{if( NR > 2 ) {print $2}}'`;do
        nova delete $vim &
done

#Unbundling router
for port in `openstack port list  |awk '{if( NR > 2 ) {print $2}}'`;do
        for router in `openstack router list| awk '{if( NR > 2 ) {print $2}}'`;do
                openstack router delete $router port=$port &
        done
done

sleep 60
# delete port
for port_d in `openstack port list |awk '{if( NR > 2 ) {print $2}}'`;do
    openstack port delete $port_d &
done

sleep 60
#delete subnet
for subnet in `openstack subnet list |awk  '{if( NR > 2 ) {print $2}}'`;do
        openstack subnet delete $subnet &
done

sleep 60
#delete net

for net in `openstack network list |awk  '{if( NR > 2 ) {print $2}}'`;do
        openstack network delete $net &
done

#delete route
for router_d in `openstack router list|awk  '{print $2}'`;do
        openstack router delete $router_d &
done

 

你可能感兴趣的:(运维)