Fix netns-cleanup broken by ProcessMonitor refactor
Change I0da6071037f9728cc20403324e36c32116bcf00d broke the netns-cleanup script. As the process_monitor parameter is now mandatory for the dhcp driver. Change-Id: I69617c67815b71a05a25936c5e7acc7c116c0dd6 Closes-bug: #1430762
This commit is contained in:
@@ -23,6 +23,7 @@ from neutron.agent.common import config as agent_config
|
||||
from neutron.agent.dhcp import config as dhcp_config
|
||||
from neutron.agent.l3 import agent as l3_agent
|
||||
from neutron.agent.linux import dhcp
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import ovs_lib
|
||||
@@ -69,6 +70,11 @@ def setup_conf():
|
||||
return conf
|
||||
|
||||
|
||||
def _get_dhcp_process_monitor(config):
|
||||
return external_process.ProcessMonitor(config=config,
|
||||
resource_type='dhcp')
|
||||
|
||||
|
||||
def kill_dhcp(conf, namespace):
|
||||
"""Disable DHCP for a network if DHCP is still active."""
|
||||
network_id = namespace.replace(dhcp.NS_PREFIX, '')
|
||||
@@ -76,6 +82,7 @@ def kill_dhcp(conf, namespace):
|
||||
dhcp_driver = importutils.import_object(
|
||||
conf.dhcp_driver,
|
||||
conf=conf,
|
||||
process_monitor=_get_dhcp_process_monitor(conf),
|
||||
network=dhcp.NetModel(conf.use_namespaces, {'id': network_id}),
|
||||
plugin=FakeDhcpPlugin())
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ class TestNetnsCleanup(base.BaseTestCase):
|
||||
util.kill_dhcp(conf, 'ns')
|
||||
|
||||
expected_params = {'conf': conf, 'network': mock.ANY,
|
||||
'process_monitor': mock.ANY,
|
||||
'plugin': mock.ANY}
|
||||
import_object.assert_called_once_with('driver', **expected_params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user