Merge "fix DHCP port changed when dhcp-agent restart"
This commit is contained in:
commit
6b56b2164a
@ -70,6 +70,9 @@ class DhcpAgent(manager.Manager):
|
|||||||
config=self.conf,
|
config=self.conf,
|
||||||
resource_type='dhcp')
|
resource_type='dhcp')
|
||||||
|
|
||||||
|
def init_host(self):
|
||||||
|
self.sync_state()
|
||||||
|
|
||||||
def _populate_networks_cache(self):
|
def _populate_networks_cache(self):
|
||||||
"""Populate the networks cache when the DHCP-agent starts."""
|
"""Populate the networks cache when the DHCP-agent starts."""
|
||||||
try:
|
try:
|
||||||
|
@ -222,6 +222,12 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||||||
self.mock_makedirs_p = mock.patch("os.makedirs")
|
self.mock_makedirs_p = mock.patch("os.makedirs")
|
||||||
self.mock_makedirs = self.mock_makedirs_p.start()
|
self.mock_makedirs = self.mock_makedirs_p.start()
|
||||||
|
|
||||||
|
def test_init_host(self):
|
||||||
|
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
|
||||||
|
with mock.patch.object(dhcp, 'sync_state') as sync_state:
|
||||||
|
dhcp.init_host()
|
||||||
|
sync_state.assert_called_once_with()
|
||||||
|
|
||||||
def test_dhcp_agent_manager(self):
|
def test_dhcp_agent_manager(self):
|
||||||
state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
|
state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
|
||||||
# sync_state is needed for this test
|
# sync_state is needed for this test
|
||||||
|
Loading…
Reference in New Issue
Block a user