Merge "dhcp/agent: fix 'get_metadata_bind_interface' driver call"
This commit is contained in:
commit
7f460ab1af
@ -206,6 +206,10 @@ class DhcpAgent(manager.Manager):
|
||||
action, action_kwargs)
|
||||
# There is nothing we can do.
|
||||
return
|
||||
if action == 'get_metadata_bind_interface':
|
||||
# Special condition, this action returns a string instead of a
|
||||
# bool.
|
||||
return self._call_driver(action, network, **action_kwargs)
|
||||
if 'segments' in network and network.segments:
|
||||
# In case of multi-segments network, let's group network per
|
||||
# segments. We can then create DHPC process per segmentation
|
||||
|
@ -405,6 +405,17 @@ class TestDhcpAgent(base.BaseTestCase):
|
||||
'iface0',
|
||||
agent.call_driver('get_metadata_bind_interface', network))
|
||||
|
||||
def test_call_driver_get_metadata_bind_interface_returns_segments(self):
|
||||
network = fake_network
|
||||
network.segments = [
|
||||
dhcp.DictModel(id='bbbbbbbb-bbbb-bbbb-bbbbbbbbbbbb')]
|
||||
network.subnets[0] = fake_subnet1
|
||||
self.driver().get_metadata_bind_interface.return_value = 'iface0'
|
||||
agent = dhcp_agent.DhcpAgent(cfg.CONF)
|
||||
self.assertEqual(
|
||||
'iface0',
|
||||
agent.call_driver('get_metadata_bind_interface', network))
|
||||
|
||||
def _test_sync_state_helper(self, known_net_ids, active_net_ids):
|
||||
active_networks = set(mock.Mock(id=netid) for netid in active_net_ids)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user