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
This commit is contained in:
Marc Koderer 2015-12-18 09:21:13 +01:00
parent 8ceb030317
commit f863b3b034
2 changed files with 16 additions and 9 deletions

View File

@ -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)

View File

@ -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")