From 65c3759674dec87c895c44d95c7b279ea4e4eb05 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Thu, 9 Aug 2012 15:32:20 -0500 Subject: Traceback when over allocating IP addresses When a user over allocates a number of IP addresses via euca-allocate-address, the user will get a nice traceback saying that they over quota for IP address allocation. Display a more userfriendly error when this happens. LP: #971609 Change-Id: If8586e246564f1069cb60bac9592f9d750522e81 Signed-off-by: Chuck Short --- nova/api/ec2/cloud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 22eb78b63..42ba1e8e5 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1098,7 +1098,10 @@ class CloudController(object): def allocate_address(self, context, **kwargs): LOG.audit(_("Allocate address"), context=context) - public_ip = self.network_api.allocate_floating_ip(context) + try: + public_ip = self.network_api.allocate_floating_ip(context) + except exception.FloatingIpLimitExceeded: + raise exception.EC2APIError(_('No more floating IPs available')) return {'publicIp': public_ip} def release_address(self, context, public_ip, **kwargs): -- cgit