Fix deletion of instances without fixed ips.
Catch exception when there are no fixed ips for an instance when deallocating it. When trying to delete failed builds I got the following traces: (nova.rpc): TRACE: Traceback (most recent call last): (nova.rpc): TRACE: File "/usr/lib64/python2.7/site-packages/nova/rpc/impl_kombu.py", line 620, in _process_data (nova.rpc): TRACE: rval = node_func(context=ctxt, **node_args) (nova.rpc): TRACE: File "/usr/lib64/python2.7/site-packages/nova/network/manager.py", line 252, in deallocate_for_instance (nova.rpc): TRACE: fixed_ips = self.db.fixed_ip_get_by_instance(context, instance_id) (nova.rpc): TRACE: File "/usr/lib64/python2.7/site-packages/nova/db/api.py", line 392, in fixed_ip_get_by_instance (nova.rpc): TRACE: return IMPL.fixed_ip_get_by_instance(context, instance_id) (nova.rpc): TRACE: File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 120, in wrapper (nova.rpc): TRACE: return f(*args, **kwargs) (nova.rpc): TRACE: File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 877, in fixed_ip_get_by_instance (nova.rpc): TRACE: raise exception.FixedIpNotFoundForInstance(instance_id=instance_id) (nova.rpc): TRACE: FixedIpNotFoundForInstance: Instance 37 has zero fixed ips. Which this commit fixes. Added myself to Authors as requested. Change-Id: I87a1764c16328c6a4bfa5a0bfab1ea4800cbb355
This commit is contained in:
parent
d29a4d077d
commit
9c7a1f0de1
1
Authors
1
Authors
|
@ -12,6 +12,7 @@ Anthony Young <sleepsonthefloor@gmail.com>
|
|||
Antony Messerli <ant@openstack.org>
|
||||
Armando Migliaccio <Armando.Migliaccio@eu.citrix.com>
|
||||
Arvind Somya <asomya@cisco.com>
|
||||
Asbjørn Sannes <asbjorn.sannes@interhost.no>
|
||||
Ben McGraw <ben@pistoncloud.com>
|
||||
Bilal Akhtar <bilalakhtar@ubuntu.com>
|
||||
Brad Hall <brad@nicira.com>
|
||||
|
|
|
@ -972,3 +972,30 @@ class CommonNetworkTestCase(test.TestCase):
|
|||
self.assertTrue(res)
|
||||
self.assertEqual(len(res), 1)
|
||||
self.assertEqual(res[0]['instance_id'], _vifs[2]['instance_id'])
|
||||
|
||||
|
||||
class TestFloatingIPManager(network_manager.FloatingIP,
|
||||
network_manager.NetworkManager):
|
||||
"""Dummy manager that implements FloatingIP"""
|
||||
|
||||
|
||||
class FloatingIPTestCase(test.TestCase):
|
||||
"""Tests nova.network.manager.FloatingIP"""
|
||||
def setUp(self):
|
||||
super(FloatingIPTestCase, self).setUp()
|
||||
self.network = TestFloatingIPManager()
|
||||
self.network.db = db
|
||||
self.project_id = 'testproject'
|
||||
self.context = context.RequestContext('testuser', self.project_id,
|
||||
is_admin=False)
|
||||
|
||||
def test_double_deallocation(self):
|
||||
instance_ref = db.api.instance_create(self.context,
|
||||
{"project_id": self.project_id})
|
||||
# Run it twice to make it fault if it does not handle
|
||||
# instances without fixed networks
|
||||
# If this fails in either, it does not handle having no addresses
|
||||
self.network.deallocate_for_instance(self.context,
|
||||
instance_id=instance_ref['id'])
|
||||
self.network.deallocate_for_instance(self.context,
|
||||
instance_id=instance_ref['id'])
|
||||
|
|
Loading…
Reference in New Issue