[Fullstack] Respawn dhclient process in case of error

When dhclient process is started as async process by fake machine resource,
it might happen that "None" will be returned as first line of output
from this process. This is treated as an error and dhclient is halted
immediately.
Because of that fake machine don't have configured IP address and
test fails.

This patch adds "respawn_timeout" value set to 5 seconds for dhclient
async process. When dhclient process is restarted it should works fine
and IP address should be then configured properly.

Change-Id: Ie056578abbe6e18c8415c6e61d755f2248a70541
Closes-Bug: #1728948
(cherry picked from commit 92959238a3)
This commit is contained in:
Sławek Kapłoński 2018-02-19 13:28:57 +01:00 committed by Daniel Alvarez
parent a9195df1ce
commit 82167ddca3
1 changed files with 2 additions and 1 deletions

View File

@ -137,7 +137,8 @@ class FakeFullstackMachine(machine_fixtures.FakeMachineBase):
cmd = ["dhclient", '-sf', self.NO_RESOLV_CONF_DHCLIENT_SCRIPT_PATH,
'--no-pid', '-d', self.port.name]
self.dhclient_async = async_process.AsyncProcess(
cmd, run_as_root=True, namespace=self.namespace)
cmd, run_as_root=True, respawn_interval=5,
namespace=self.namespace)
self.dhclient_async.start()
def _stop_async_dhclient(self):