From e21de667f23a70569dec6a385b45ab875f48c504 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 11 Jul 2012 13:57:41 -0400 Subject: [PATCH] Always attempt to delete entire floating IP range. Fix bug 1021222. This patch tweaks nova-manage to always attempt to delete all addresses in the specified IP range, even if an error is encountered. This is an easy way to handle a case where a range was created, but then a subset of that range was deleted. Otherwise, deleting the rest of the range is a pain. An example of this would be: # nova-manage floating create --ip_range=1.1.1.0/24 # nova-manage floating delete 1.1.1.1 # nova-manage floating delete 1.1.1.0/24 Previously this would fail. Now it works. Change-Id: Ia01c04dee5383f597976c6a79d9a0d9e19985898 --- bin/nova-manage | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index e31971579..8e46284c3 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -366,8 +366,11 @@ class FloatingIpCommands(object): def delete(self, ip_range): """Deletes floating ips by range""" for address in self.address_to_hosts(ip_range): - db.floating_ip_destroy(context.get_admin_context(), - str(address)) + try: + db.floating_ip_destroy(context.get_admin_context(), + str(address)) + except exception.FloatingIpNotFoundForAddress as ex: + print "Warning: %s" % ex @args('--host', dest="host", metavar='', help='Host') def list(self, host=None):