From 02dabd6f102154a132650c74cca0599c983f2018 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Thu, 13 Dec 2018 21:42:58 +0000 Subject: [PATCH] Add debug information of the dhclient process Log the standard output/error of the dhclient process which provides more information of the execution of the DHCP client script. Change-Id: I6a057d089ee21ea2898078fb7b11dce00a570ec0 --- neutron/tests/fullstack/resources/machine.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/neutron/tests/fullstack/resources/machine.py b/neutron/tests/fullstack/resources/machine.py index 74580cc39f7..37429ce7ef7 100644 --- a/neutron/tests/fullstack/resources/machine.py +++ b/neutron/tests/fullstack/resources/machine.py @@ -16,6 +16,7 @@ from distutils import spawn import itertools import netaddr +from oslo_log import log as logging from neutron_lib.api.definitions import portbindings as pbs from neutron_lib import constants @@ -27,6 +28,7 @@ from neutron.tests.common import machine_fixtures from neutron.tests.common import net_helpers FULLSTACK_DHCLIENT_SCRIPT = 'fullstack-dhclient-script' +LOG = logging.getLogger(__name__) class FakeFullstackMachinesList(list): @@ -146,6 +148,12 @@ class FakeFullstackMachine(machine_fixtures.FakeMachineBase): return try: self.dhclient_async.stop() + cmd = self.dhclient_async.cmd + stdout = list(self.dhclient_async.iter_stdout()) + stderr = list(self.dhclient_async.iter_stderr()) + LOG.debug('Stopping async dhclient [%(cmd)s]. stdout: ' + '[%(stdout)s] - stderr: [%(stderr)s]', + {'cmd': cmd, 'stdout': stdout, 'stderr': stderr}) except async_process.AsyncProcessException: # If it was already stopped than we don't care about it pass