Merge "radvd: pass -m syslog to avoid thread lock for radvd 2.0+"
This commit is contained in:
commit
7236edfe6a
@ -82,9 +82,15 @@ def _generate_radvd_conf(router_id, router_ports, dev_name_helper):
|
||||
|
||||
def _spawn_radvd(router_id, radvd_conf, router_ns, root_helper):
|
||||
def callback(pid_file):
|
||||
# we need to use -m syslog and f.e. not -m stderr (the default)
|
||||
# or -m stderr_syslog so that radvd 2.0+ will close stderr and
|
||||
# exit after daemonization; otherwise, the current thread will
|
||||
# be locked waiting for result from radvd that won't ever come
|
||||
# until the process dies
|
||||
radvd_cmd = ['radvd',
|
||||
'-C', '%s' % radvd_conf,
|
||||
'-p', '%s' % pid_file]
|
||||
'-p', '%s' % pid_file,
|
||||
'-m', 'syslog']
|
||||
return radvd_cmd
|
||||
|
||||
radvd = external_process.ProcessManager(cfg.CONF,
|
||||
|
@ -28,6 +28,7 @@ from neutron.agent.l3 import ha
|
||||
from neutron.agent.l3 import link_local_allocator as lla
|
||||
from neutron.agent.l3 import router_info as l3router
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.agent.linux import ra
|
||||
from neutron.common import config as base_config
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
@ -2161,6 +2162,38 @@ vrrp_instance VR_1 {
|
||||
self.assertFalse(nat.add_rule.called)
|
||||
nat.clear_rules_by_tag.assert_called_once_with('floating_ip')
|
||||
|
||||
def test_spawn_radvd(self):
|
||||
router = prepare_router_data()
|
||||
|
||||
conffile = '/fake/radvd.conf'
|
||||
pidfile = '/fake/radvd.pid'
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
|
||||
# we don't want the whole process manager to be mocked to be
|
||||
# able to catch execute() calls
|
||||
self.external_process_p.stop()
|
||||
self.ip_cls_p.stop()
|
||||
|
||||
get_pid_file_name = ('neutron.agent.linux.external_process.'
|
||||
'ProcessManager.get_pid_file_name')
|
||||
with mock.patch('neutron.agent.linux.utils.execute') as execute:
|
||||
with mock.patch(get_pid_file_name) as get_pid:
|
||||
get_pid.return_value = pidfile
|
||||
ra._spawn_radvd(router['id'],
|
||||
conffile,
|
||||
agent.get_ns_name(router['id']),
|
||||
self.conf.root_helper)
|
||||
cmd = execute.call_args[0][0]
|
||||
|
||||
self.assertIn('radvd', cmd)
|
||||
|
||||
_join = lambda *args: ' '.join(args)
|
||||
|
||||
cmd = _join(*cmd)
|
||||
self.assertIn(_join('-C', conffile), cmd)
|
||||
self.assertIn(_join('-p', pidfile), cmd)
|
||||
self.assertIn(_join('-m', 'syslog'), cmd)
|
||||
|
||||
|
||||
class TestL3AgentEventHandler(base.BaseTestCase):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user