Disable process monitor for keepalived test

There was an existing attempt to disable process monitoring, but
since the AGENT.check_child_processes_interval defaults to 60 and
is checked in ProcessMonitor.__init__, overriding the config value
after instantiating the ProcessMonitor only has the affect of
making the check happen continually as quickly as possible instead
of not at all. Instead, we instantiate the process monitor after
changing the config value.

Change-Id: Ic4907b6a227c6fa8288c9d3e2106da0b53323509
Closes-Bug: #1665061
(cherry picked from commit 0faf1aa49f)
This commit is contained in:
Terry Wilson 2017-02-15 12:53:44 -06:00 committed by Ihar Hrachyshka
parent 20612b5d3a
commit 01cb8b1c44
1 changed files with 4 additions and 2 deletions

View File

@ -249,7 +249,7 @@ class KeepalivedIPv6Test(object):
self.config = None
self.config_path = None
self.nsname = "keepalivedtest-" + uuidutils.generate_uuid()
self.pm = external_process.ProcessMonitor(cfg.CONF, 'router')
self.pm = None
self.orig_interval = cfg.CONF.AGENT.check_child_processes_interval
def configure(self):
@ -274,6 +274,7 @@ class KeepalivedIPv6Test(object):
def start_keepalived_process(self):
# Disable process monitoring for Keepalived process.
cfg.CONF.set_override('check_child_processes_interval', 0, 'AGENT')
self.pm = external_process.ProcessMonitor(cfg.CONF, 'router')
# Create a temp directory to store keepalived configuration.
self.config_path = tempfile.mkdtemp()
@ -300,7 +301,8 @@ class KeepalivedIPv6Test(object):
return self
def __exit__(self, exc_type, exc_value, exc_tb):
self.pm.stop()
if self.pm:
self.pm.stop()
if self.manager:
self.manager.disable()
if self.config_path: