summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJohn Tran <jtran@attinteractive.com>2011-06-10 11:10:58 -0700
committerJohn Tran <jtran@attinteractive.com>2011-06-10 11:10:58 -0700
commit05fecdf873a5c02dcb13c841304df872411d4183 (patch)
tree313446be69f8137c451a734c58c21f31bae22a14 /nova
parent0e7a2042cc5922bb014a77080ec0bdb93bbf575c (diff)
added new exception more descriptive of not having available floating addresses avail for allocation
Diffstat (limited to 'nova')
-rw-r--r--nova/api/ec2/cloud.py2
-rw-r--r--nova/exception.py4
-rw-r--r--nova/tests/test_cloud.py2
3 files changed, 6 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 5ed473b73..e1c65ae40 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -878,7 +878,7 @@ class CloudController(object):
return {'publicIp': public_ip}
except rpc.RemoteError as ex:
if ex.exc_type == 'NoMoreAddresses':
- raise exception.NoFloatingIpsDefined()
+ raise exception.NoMoreFloatingIps()
else:
raise
diff --git a/nova/exception.py b/nova/exception.py
index 69b3e0359..1571dd032 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -376,6 +376,10 @@ class NoFloatingIpsDefinedForInstance(NoFloatingIpsDefined):
message = _("Zero floating ips defined for instance %(instance_id)s.")
+class NoMoreFloatingIps(NotFound):
+ message = _("Zero floating ips available.")
+
+
class KeypairNotFound(NotFound):
message = _("Keypair %(keypair_name)s not found for user %(user_id)s")
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py
index c8313a5d3..13046f861 100644
--- a/nova/tests/test_cloud.py
+++ b/nova/tests/test_cloud.py
@@ -123,7 +123,7 @@ class CloudTestCase(test.TestCase):
'host': self.network.host})
self.assertEqual(allocate(self.context)['publicIp'], address)
db.floating_ip_destroy(self.context, address)
- self.assertRaises(exception.NoFloatingIpsDefined,
+ self.assertRaises(exception.NoMoreFloatingIps,
allocate,
self.context)