diff options
author | Rex Lee <limingjiang@huawei.com> | 2018-11-09 02:01:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-11-09 02:01:55 +0000 |
commit | abb107e1c4735713b430455a5980f1cf86f7a974 (patch) | |
tree | 2ca05fd543340147d567deec953b3a69dfd24395 | |
parent | 06d14a97d06b5b8a1c20630304fd93439121522f (diff) | |
parent | a9db50ee51788e0d05e0a3e5f82abb4c2c6dd50c (diff) |
Merge "add error logs to storperf" into stable/gambia
-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']) |