diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-05-14 18:39:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-05-14 18:39:18 +0000 |
| commit | 0e09b3357bf0fbce93a51996dec1ce5a7b93b859 (patch) | |
| tree | 361895a04d96e8b99d74566f538eb372fba0dd01 /nova/api | |
| parent | 5ada1043a16666f6c71ade987711fc1e3f1b6398 (diff) | |
| parent | 8b597f76f980769e83a36111ca8fcd8b988d236c (diff) | |
| download | nova-0e09b3357bf0fbce93a51996dec1ce5a7b93b859.tar.gz nova-0e09b3357bf0fbce93a51996dec1ce5a7b93b859.tar.xz nova-0e09b3357bf0fbce93a51996dec1ce5a7b93b859.zip | |
Merge "Make allocation failure a bit more friendly"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index dcc0d17b9..70933d2bc 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1282,18 +1282,24 @@ class CloudController(object): def release_address(self, context, public_ip, **kwargs): LOG.audit(_("Release address %s"), public_ip, context=context) - self.network_api.release_floating_ip(context, address=public_ip) - return {'return': "true"} + try: + self.network_api.release_floating_ip(context, address=public_ip) + return {'return': "true"} + except exception.FloatingIpNotFound: + raise exception.EC2APIError(_('Unable to release IP Address.')) def associate_address(self, context, instance_id, public_ip, **kwargs): LOG.audit(_("Associate address %(public_ip)s to" " instance %(instance_id)s") % locals(), context=context) instance_id = ec2utils.ec2_id_to_id(instance_id) instance = self.compute_api.get(context, instance_id) - self.compute_api.associate_floating_ip(context, - instance, - address=public_ip) - return {'return': "true"} + try: + self.compute_api.associate_floating_ip(context, + instance, + address=public_ip) + return {'return': "true"} + except exception.FloatingIpNotFound: + raise exception.EC2APIError(_('Unable to associate IP Address.')) def disassociate_address(self, context, public_ip, **kwargs): LOG.audit(_("Disassociate address %s"), public_ip, context=context) |
