Merge "Fixes missing ec2 api address disassociate error on failure"
This commit is contained in:
commit
30b66a90a4
@ -1323,6 +1323,9 @@ class CloudController(object):
|
||||
LOG.audit(_("Disassociate address %s"), public_ip, context=context)
|
||||
self.network_api.disassociate_floating_ip(context, instance,
|
||||
address=public_ip)
|
||||
else:
|
||||
msg = _('Floating ip is not associated.')
|
||||
raise exception.InvalidAssociation(message=msg)
|
||||
return {'return': "true"}
|
||||
|
||||
def run_instances(self, context, **kwargs):
|
||||
|
@ -1293,6 +1293,11 @@ class InstanceInfoCacheNotFound(NotFound):
|
||||
"found.")
|
||||
|
||||
|
||||
class InvalidAssociation(NotFound):
|
||||
ec2_code = 'InvalidAssociationID.NotFound'
|
||||
msg_fmt = _("Invalid association.")
|
||||
|
||||
|
||||
class NodeNotFound(NotFound):
|
||||
msg_fmt = _("Node %(node_id)s could not be found.")
|
||||
|
||||
|
@ -389,9 +389,9 @@ class CloudTestCase(test.TestCase):
|
||||
'pool': 'nova'})
|
||||
self.cloud.allocate_address(self.context)
|
||||
self.cloud.describe_addresses(self.context)
|
||||
result = self.cloud.disassociate_address(self.context,
|
||||
public_ip=address)
|
||||
self.assertEqual(result['return'], 'true')
|
||||
self.assertRaises(exception.InvalidAssociation,
|
||||
self.cloud.disassociate_address,
|
||||
self.context, public_ip=address)
|
||||
db.floating_ip_destroy(self.context, address)
|
||||
|
||||
def test_describe_security_groups(self):
|
||||
|
Loading…
Reference in New Issue
Block a user