# not required, set this to False for a performance improvement.
# use_helper_for_ns_read = True
+# The interval to check external processes for failure in seconds (0=disabled)
+# check_child_processes_interval = 0
+
+# Action to take when an external process spawned by an agent dies
+# Values:
+# respawn - Respawns the external process
+# exit - Exits the agent
+# check_child_processes_action = respawn
+
# =========== items for agent management extension =============
# seconds between nodes reporting state to server; should be less than
# agent_down_time, best if it is half or less than agent_down_time
help=_("Add comments to iptables rules.")),
]
+PROCESS_MONITOR_OPTS = [
+ cfg.StrOpt('check_child_processes_action', default='respawn',
+ choices=['respawn', 'exit'],
+ help=_('Action to be executed when a child process dies')),
+ cfg.IntOpt('check_child_processes_interval', default=0,
+ help=_('Interval between checks of child process liveness '
+ '(seconds), use 0 to disable')),
+]
+
def get_log_args(conf, log_file_name):
cmd_args = []
conf.register_opts(IPTABLES_OPTS, 'AGENT')
+def register_process_monitor_opts(conf):
+ conf.register_opts(PROCESS_MONITOR_OPTS, 'AGENT')
+
+
def get_root_helper(conf):
root_helper = conf.AGENT.root_helper
if root_helper != 'sudo':
from oslo.config import cfg
from oslo_concurrency import lockutils
+from neutron.agent.common import config as agent_cfg
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.i18n import _LE
cfg.StrOpt('external_pids',
default='$state_path/external/pids',
help=_('Location to store child pid files')),
- cfg.StrOpt('check_child_processes_action', default='respawn',
- choices=['respawn', 'exit'],
- help=_('Action to be executed when a child process dies')),
- cfg.IntOpt('check_child_processes_interval', default=0,
- help=_('Interval between checks of child process liveness '
- '(seconds), use 0 to disable')),
]
cfg.CONF.register_opts(OPTS)
+agent_cfg.register_process_monitor_opts(cfg.CONF)
class ProcessManager(object):
self._process_managers = {}
- if self._config.check_child_processes_interval:
+ if self._config.AGENT.check_child_processes_interval:
self._spawn_checking_thread()
def enable(self, uuid, cmd_callback, namespace=None, service=None,
def _periodic_checking_thread(self):
while True:
- eventlet.sleep(self._config.check_child_processes_interval)
+ eventlet.sleep(self._config.AGENT.check_child_processes_interval)
eventlet.spawn(self._check_child_processes)
def _execute_action(self, service_id):
- action_function = getattr(
- self, "_%s_action" % self._config.check_child_processes_action)
+ action = self._config.AGENT.check_child_processes_action
+ action_function = getattr(self, "_%s_action" % action)
action_function(service_id)
def _respawn_action(self, service_id):
def setUp(self):
super(BaseTestProcessMonitor, self).setUp()
self._exit_handler_called = False
- cfg.CONF.set_override('check_child_processes_interval', 1)
+ cfg.CONF.set_override('check_child_processes_interval', 1, 'AGENT')
self._child_processes = []
self._ext_processes = None
self.addCleanup(self.cleanup_spawned_children)
def create_child_processes_manager(self, action):
- cfg.CONF.set_override('check_child_processes_action', action)
+ cfg.CONF.set_override('check_child_processes_action', action, 'AGENT')
self._ext_processes = external_process.ProcessMonitor(
config=cfg.CONF,
root_helper=None,
# we need to allow extra_time for the check process to happen
# and properly execute action over the gone processes under
# high load conditions
- max_wait_time = cfg.CONF.check_child_processes_interval + extra_time
+ max_wait_time = (
+ cfg.CONF.AGENT.check_child_processes_interval + extra_time)
with self.assert_max_execution_time(max_wait_time):
while not exit_condition():
eventlet.sleep(0.01)
def create_child_process_monitor(self, action):
self.exit_handler = mock.Mock()
conf = mock.Mock()
- conf.check_child_processes_action = action
- conf.check_child_processes = True
+ conf.AGENT.check_child_processes_action = action
+ conf.AGENT.check_child_processes = True
self.pmonitor = external_process.ProcessMonitor(
config=conf,
root_helper=None,