diff options
author | Abhijit Sinha <abhijit.sinha@intel.com> | 2018-11-08 11:17:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-11-08 11:17:47 +0000 |
commit | f20fecd5d63ec21fae95bf10b0e766bd6eb9e80b (patch) | |
tree | 752ac9b76110c33af1467eae1e8c969bd61e48f0 | |
parent | f48d48b4abe0b876749ef4042ce8bef4f1822a0d (diff) | |
parent | bf61bbcc3df896707841230b6959e4ac51223986 (diff) |
Merge "add error logs to storperf"
-rw-r--r-- | yardstick/benchmark/scenarios/storage/storperf.py | 37 |
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']) |