diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-10 20:11:45 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-10 20:11:45 +0000 |
| commit | 584c968259d40a9c5a4a2e75c50fda45990996a5 (patch) | |
| tree | 1e0f1bef008f9d5729954de62a410a51e0800e53 /nova/api | |
| parent | d222953038e3b602c2074199049a210344cbc0f6 (diff) | |
| parent | a0150a4d9e751ec222221558dfe89a66b0c118ab (diff) | |
Merge "Add the serialization of exceptions for RPC calls."
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 12 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 17 |
2 files changed, 7 insertions, 22 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 2ff5b32c6..9346d107b 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -41,7 +41,6 @@ from nova import flags from nova.image import s3 from nova import log as logging from nova import network -from nova.rpc import common as rpc_common from nova import utils from nova import volume @@ -1253,15 +1252,8 @@ class CloudController(object): def allocate_address(self, context, **kwargs): LOG.audit(_("Allocate address"), context=context) - try: - public_ip = self.network_api.allocate_floating_ip(context) - return {'publicIp': public_ip} - except rpc_common.RemoteError as ex: - # NOTE(tr3buchet) - why does this block exist? - if ex.exc_type == 'NoMoreFloatingIps': - raise exception.NoMoreFloatingIps() - else: - raise + public_ip = self.network_api.allocate_floating_ip(context) + return {'publicIp': public_ip} def release_address(self, context, public_ip, **kwargs): LOG.audit(_("Release address %s"), public_ip, context=context) diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py index 6b9e9e97c..4a5cec8d2 100644 --- a/nova/api/openstack/compute/contrib/floating_ips.py +++ b/nova/api/openstack/compute/contrib/floating_ips.py @@ -152,16 +152,12 @@ class FloatingIPController(object): try: address = self.network_api.allocate_floating_ip(context, pool) ip = self.network_api.get_floating_ip_by_address(context, address) - except rpc_common.RemoteError as ex: - # NOTE(tr3buchet) - why does this block exist? - if ex.exc_type == 'NoMoreFloatingIps': - if pool: - msg = _("No more floating ips in pool %s.") % pool - else: - msg = _("No more floating ips available.") - raise webob.exc.HTTPBadRequest(explanation=msg) + except exception.NoMoreFloatingIps: + if pool: + msg = _("No more floating ips in pool %s.") % pool else: - raise + msg = _("No more floating ips available.") + raise webob.exc.HTTPBadRequest(explanation=msg) return _translate_floating_ip_view(ip) @@ -212,9 +208,6 @@ class FloatingIPActionController(wsgi.Controller): except exception.FixedIpNotFoundForInstance: msg = _("No fixed ips associated to instance") raise webob.exc.HTTPBadRequest(explanation=msg) - except rpc_common.RemoteError: - msg = _("Associate floating ip failed") - raise webob.exc.HTTPInternalServerError(explanation=msg) return webob.Response(status_int=202) |
