Remove unused bridge interfaces
If a network gateway of multi hosted network is unsed by any VM on the host, we tear down it. It is implemented only with the VLAN manager. Fixes LP bug #1084651 Change-Id: Ia7e399de5b8ddf6ec252d38dfbb8762c4f14e3a5
This commit is contained in:
@@ -582,6 +582,23 @@ class DbApiTestCase(test.TestCase):
|
|||||||
data = db.network_get_all_by_host(ctxt, 'foo')
|
data = db.network_get_all_by_host(ctxt, 'foo')
|
||||||
self.assertEqual(len(data), 3)
|
self.assertEqual(len(data), 3)
|
||||||
|
|
||||||
|
def test_network_in_use_on_host(self):
|
||||||
|
ctxt = context.get_admin_context()
|
||||||
|
|
||||||
|
values = {'host': 'foo', 'hostname': 'myname'}
|
||||||
|
instance = db.instance_create(ctxt, values)
|
||||||
|
values = {'address': 'bar', 'instance_uuid': instance['uuid']}
|
||||||
|
vif = db.virtual_interface_create(ctxt, values)
|
||||||
|
values = {'address': 'baz',
|
||||||
|
'network_id': 1,
|
||||||
|
'allocated': True,
|
||||||
|
'instance_uuid': instance['uuid'],
|
||||||
|
'virtual_interface_id': vif['id']}
|
||||||
|
db.fixed_ip_create(ctxt, values)
|
||||||
|
|
||||||
|
self.assertEqual(db.network_in_use_on_host(ctxt, 1, 'foo'), True)
|
||||||
|
self.assertEqual(db.network_in_use_on_host(ctxt, 1, 'bar'), False)
|
||||||
|
|
||||||
def _timeout_test(self, ctxt, timeout, multi_host):
|
def _timeout_test(self, ctxt, timeout, multi_host):
|
||||||
values = {'host': 'foo'}
|
values = {'host': 'foo'}
|
||||||
instance = db.instance_create(ctxt, values)
|
instance = db.instance_create(ctxt, values)
|
||||||
|
|||||||
Reference in New Issue
Block a user