Created
April 4, 2013 18:40
-
-
Save djoreilly/5312984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from quantumclient.quantum import client as qclient | |
from novaclient.v1_1 import client as nclient | |
import novaclient.exceptions as nova_exc | |
KEYSTONE_URL='http://10.0.10.10:5000/v2.0' | |
qc = qclient.Client('2.0', auth_url=KEYSTONE_URL, username='admin', | |
tenant_name='demo', password='secrete') | |
nc = nclient.Client('admin', 'secrete', 'demo', KEYSTONE_URL, | |
service_type='compute') | |
try: | |
nc.servers.delete(nc.servers.list(search_opts={'name': 'vm1'})[0]) | |
except: | |
pass | |
print "wait a while for nova to release quantum ports" | |
time.sleep(5) | |
for fip in qc.list_floatingips()['floatingips']: | |
qc.delete_floatingip(fip['id']) | |
qc.delete_network(qc.list_networks(name='net1')['networks'][0]['id']) | |
qc.delete_router(qc.list_routers(name='router1')['routers'][0]['id']) | |
qc.delete_network(qc.list_networks(name='ext-net')['networks'][0]['id']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment