It's not always possible/convenient to get namespace name
when need to disable some process (like metadata process for stale
router, see related bug). Since namespace name is not required
for process manager to disable process we can remove this parameter
from disable_isolated_metadata_proxy()
Change-Id: I0e0da01d9640aa9920f41989804fc6f320c1c1eb
Related-Bug: #
1455042
def disable_isolated_metadata_proxy(self, network):
metadata_driver.MetadataDriver.destroy_monitored_metadata_proxy(
- self._process_monitor, network.id, network.namespace, self.conf)
+ self._process_monitor, network.id, self.conf)
class DhcpPluginApi(object):
else:
LOG.debug('Closing metadata proxy for router %s', router_id)
self.metadata_driver.destroy_monitored_metadata_proxy(
- self.process_monitor, ri.router_id, ri.ns_name, self.conf)
+ self.process_monitor, ri.router_id, self.conf)
def _update_radvd_daemon(self, ri, state):
# Radvd has to be spawned only on the Master HA Router. If there are
uuid = network_id or router_id
callback = cls._get_metadata_proxy_callback(
port, conf, network_id=network_id, router_id=router_id)
- pm = cls._get_metadata_proxy_process_manager(uuid, ns_name, conf,
+ pm = cls._get_metadata_proxy_process_manager(uuid, conf,
+ ns_name=ns_name,
callback=callback)
pm.enable()
monitor.register(uuid, METADATA_SERVICE_NAME, pm)
@classmethod
- def destroy_monitored_metadata_proxy(cls, monitor, uuid, ns_name, conf):
+ def destroy_monitored_metadata_proxy(cls, monitor, uuid, conf):
monitor.unregister(uuid, METADATA_SERVICE_NAME)
- pm = cls._get_metadata_proxy_process_manager(uuid, ns_name, conf)
+ # No need to pass ns name as it's not needed for disable()
+ pm = cls._get_metadata_proxy_process_manager(uuid, conf)
pm.disable()
@classmethod
- def _get_metadata_proxy_process_manager(cls, router_id, ns_name, conf,
+ def _get_metadata_proxy_process_manager(cls, router_id, conf, ns_name=None,
callback=None):
return external_process.ProcessManager(
conf=conf,
proxy.destroy_monitored_metadata_proxy(l3_agent.process_monitor,
router.router['id'],
- router.ns_name,
l3_agent.conf)
)
self.external_process = self.external_process_p.start()
- def _process_manager_constructor_call(self):
+ def _process_manager_constructor_call(self, ns=FAKE_NETWORK_DHCP_NS):
return mock.call(conf=cfg.CONF,
uuid=FAKE_NETWORK_UUID,
- namespace=FAKE_NETWORK_DHCP_NS,
+ namespace=ns,
default_cmd_callback=mock.ANY)
def _enable_dhcp_helper(self, network, enable_isolated_metadata=False,
self.call_driver.assert_called_once_with('disable', fake_network)
if isolated_metadata:
self.external_process.assert_has_calls([
- self._process_manager_constructor_call(),
+ self._process_manager_constructor_call(ns=None),
mock.call().disable()])
else:
self.assertFalse(self.external_process.call_count)
[mock.call.get_network_by_id(fake_network.id)])
if isolated_metadata:
self.external_process.assert_has_calls([
- self._process_manager_constructor_call(),
+ self._process_manager_constructor_call(ns=None),
mock.call().disable()
])
else:
self.dhcp.disable_isolated_metadata_proxy(fake_network)
destroy.assert_called_once_with(self.dhcp._process_monitor,
fake_network.id,
- fake_network.namespace,
cfg.CONF)
def _test_metadata_network(self, network):
if enableflag:
destroy_proxy.assert_called_with(mock.ANY,
router_id,
- mock.ANY,
mock.ANY)
else:
self.assertFalse(destroy_proxy.call_count)