From 463e0388308760dbf3bf2b3fa901d8076d002f91 Mon Sep 17 00:00:00 2001 From: John Tran Date: Thu, 9 Jun 2011 00:01:42 -0700 Subject: matched the inner exception specifically, instead of catching all RemoteError exceptions --- nova/api/ec2/cloud.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 6c5dba8ed..84a83d8e6 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -876,8 +876,11 @@ class CloudController(object): try: public_ip = self.network_api.allocate_floating_ip(context) return {'publicIp': public_ip} - except rpc.RemoteError: - raise exception.NoFloatingIpsDefined + except rpc.RemoteError as ex: + if ex.exc_type == 'NoMoreAddresses': + raise exception.NoFloatingIpsDefined + else: + raise def release_address(self, context, public_ip, **kwargs): LOG.audit(_("Release address %s"), public_ip, context=context) -- cgit