aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmeed Ashour <Ameed.Ashour.Ext@nokia.com>2018-09-04 10:51:25 +0300
committerAmeed Ashour <ameed.ashour.ext@nokia.com>2018-11-08 10:03:59 +0000
commita9db50ee51788e0d05e0a3e5f82abb4c2c6dd50c (patch)
tree4059f28dc805bfe656d1dbec84ccc43d3dda3bae
parentf325b13d7317a64b22591670dd765a6fb0c4d8a8 (diff)
add error logs to storperf
add error logs to storperf.py in order to show the errors in task log API JIRA: YARDSTICK-1407 Change-Id: I7cefd09cbd7bdefca98c9220f886675b6a5b02a4 Signed-off-by: Ameed Ashour <Ameed.Ashour.Ext@nokia.com>
-rw-r--r--yardstick/benchmark/scenarios/storage/storperf.py37
1 files changed, 21 insertions, 16 deletions
diff --git a/yardstick/benchmark/scenarios/storage/storperf.py b/yardstick/benchmark/scenarios/storage/storperf.py
index e4c72dc8f..7c8e5fe66 100644
--- a/yardstick/benchmark/scenarios/storage/storperf.py
+++ b/yardstick/benchmark/scenarios/storage/storperf.py
@@ -102,13 +102,14 @@ class StorPerf(base.Scenario):
setup_res = requests.post('http://%s:5000/api/v1.0/configurations'
% self.target, json=env_args)
- setup_res_content = jsonutils.loads(
- setup_res.content)
if setup_res.status_code != 200:
- raise RuntimeError("Failed to create a stack, error message:",
- setup_res_content["message"])
+ LOG.error("Failed to create stack. %s: %s",
+ setup_res.status_code, setup_res.content)
+ raise RuntimeError("Failed to create stack. %s: %s" %
+ (setup_res.status_code, setup_res.content))
elif setup_res.status_code == 200:
+ setup_res_content = jsonutils.loads(setup_res.content)
LOG.info("stack_id: %s", setup_res_content["stack_id"])
while not self._query_setup_state():
@@ -122,14 +123,15 @@ class StorPerf(base.Scenario):
def _query_job_state(self, job_id):
"""Query the status of the supplied job_id and report on metrics"""
LOG.info("Fetching report for %s...", job_id)
- report_res = requests.get('http://{}:5000/api/v1.0/jobs'.format
- (self.target),
+ report_res = requests.get('http://%s:5000/api/v1.0/jobs' % self.target,
params={'id': job_id, 'type': 'status'})
report_res_content = jsonutils.loads(
report_res.content)
if report_res.status_code != 200:
+ LOG.error("Failed to fetch report, error message: %s",
+ report_res_content["message"])
raise RuntimeError("Failed to fetch report, error message:",
report_res_content["message"])
else:
@@ -186,15 +188,15 @@ class StorPerf(base.Scenario):
LOG.info("Starting a job with parameters %s", job_args)
job_res = requests.post('http://%s:5000/api/%s/jobs' % (self.target,
- api_version),
- json=job_args)
-
- job_res_content = jsonutils.loads(job_res.content)
+ api_version), json=job_args)
if job_res.status_code != 200:
- raise RuntimeError("Failed to start a job, error message:",
- job_res_content["message"])
+ LOG.error("Failed to start job. %s: %s",
+ job_res.status_code, job_res.content)
+ raise RuntimeError("Failed to start job. %s: %s" %
+ (job_res.status_code, job_res.content))
elif job_res.status_code == 200:
+ job_res_content = jsonutils.loads(job_res.content)
job_id = job_res_content["job_id"]
LOG.info("Started job id: %s...", job_id)
@@ -247,13 +249,14 @@ class StorPerf(base.Scenario):
job_res = requests.post('http://%s:5000/api/v1.0/initializations' %
self.target, json=job_args)
- job_res_content = jsonutils.loads(job_res.content)
if job_res.status_code != 200:
- raise RuntimeError(
- "Failed to start initialization job, error message:",
- job_res_content["message"])
+ LOG.error("Failed to start initialization job, error message: %s: %s",
+ job_res.status_code, job_res.content)
+ raise RuntimeError("Failed to start initialization job, error message: %s: %s" %
+ (job_res.status_code, job_res.content))
elif job_res.status_code == 200:
+ job_res_content = jsonutils.loads(job_res.content)
job_id = job_res_content["job_id"]
LOG.info("Started initialization as job id: %s...", job_id)
@@ -271,6 +274,8 @@ class StorPerf(base.Scenario):
if teardown_res.status_code == 400:
teardown_res_content = jsonutils.loads(
teardown_res.json_data)
+ LOG.error("Failed to reset environment, error message: %s",
+ teardown_res_content['message'])
raise RuntimeError("Failed to reset environment, error message:",
teardown_res_content['message'])