From f863b3b034e1e3761424ee19b0d8b6d574e4385d Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Fri, 18 Dec 2015 09:21:13 +0100 Subject: [PATCH] Add stdout logging for stress Align cmd stress that all user output (final results and errors) will be visible for the CLI user. Change-Id: Id4b792e93bdbb45a42fe2c46a044a65ba5dcfb04 Closes-bug: #1527142 --- tempest/cmd/run_stress.py | 10 +++++++++- tempest/stress/driver.py | 15 +++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tempest/cmd/run_stress.py b/tempest/cmd/run_stress.py index f99e5d9e1a..fb0e8c72b7 100644 --- a/tempest/cmd/run_stress.py +++ b/tempest/cmd/run_stress.py @@ -22,6 +22,7 @@ try: except ImportError: # unittest in python 2.6 does not contain loader, so uses unittest2 from unittest2 import loader +import traceback from cliff import command from oslo_log import log as logging @@ -79,7 +80,13 @@ class TempestRunStress(command.Command): return pa def take_action(self, pa): - return action(pa) + try: + action(pa) + except Exception: + LOG.exception("Failure in the stress test framework") + traceback.print_exc() + raise + return 0 def add_arguments(parser): @@ -149,4 +156,5 @@ if __name__ == "__main__": sys.exit(main()) except Exception: LOG.exception("Failure in the stress test framework") + traceback.print_exc() sys.exit(1) diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py index a550d71206..4dcaab7acd 100644 --- a/tempest/stress/driver.py +++ b/tempest/stress/driver.py @@ -239,14 +239,13 @@ def stress_openstack(tests, duration, max_runs=None, stop_on_error=False): had_errors = True sum_runs += process['statistic']['runs'] sum_fails += process['statistic']['fails'] - LOG.info(" Process %d (%s): Run %d actions (%d failed)" % - (process['p_number'], - process['action'], - process['statistic']['runs'], - process['statistic']['fails'])) - LOG.info("Summary:") - LOG.info("Run %d actions (%d failed)" % - (sum_runs, sum_fails)) + print ("Process %d (%s): Run %d actions (%d failed)" % ( + process['p_number'], + process['action'], + process['statistic']['runs'], + process['statistic']['fails'])) + print ("Summary:") + print ("Run %d actions (%d failed)" % (sum_runs, sum_fails)) if not had_errors and CONF.stress.full_clean_stack: LOG.info("cleaning up")