diff options
-rw-r--r-- | api/resources/v1/tasks.py | 50 | ||||
-rw-r--r-- | api/urls.py | 1 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml | 4 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml | 4 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/compute/qemu_migrate.py | 2 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash | 6 |
13 files changed, 75 insertions, 20 deletions
diff --git a/api/resources/v1/tasks.py b/api/resources/v1/tasks.py new file mode 100644 index 000000000..52455fbf5 --- /dev/null +++ b/api/resources/v1/tasks.py @@ -0,0 +1,50 @@ +############################################################################## +# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +import os +import errno +import uuid + +from api import ApiResource +from api.database.v1.handlers import TasksHandler +from yardstick.common import constants as consts +from yardstick.common.utils import result_handler + + +class V1TaskLog(ApiResource): + def get(self, task_id): + + try: + uuid.UUID(task_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid task_id') + + task_handler = TasksHandler() + try: + task = task_handler.get_task_by_taskid(task_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid task_id') + + index = int(self._get_args().get('index', 0)) + + try: + with open(os.path.join(consts.TASK_LOG_DIR, '{}.log'.format(task_id))) as f: + f.seek(index) + data = f.readlines() + index = f.tell() + except OSError as e: + if e.errno == errno.ENOENT: + return result_handler(consts.API_ERROR, 'log file does not exist') + return result_handler(consts.API_ERROR, 'error with log file') + + return_data = { + 'index': index, + 'data': data + } + + return result_handler(task.status, return_data) diff --git a/api/urls.py b/api/urls.py index 9b0040b6c..4b8e39e8f 100644 --- a/api/urls.py +++ b/api/urls.py @@ -20,6 +20,7 @@ urlpatterns = [ Url('/yardstick/testsuites/action', 'v1_test_suite'), Url('/yardstick/results', 'v1_result'), Url('/yardstick/env/action', 'v1_env'), + Url('/yardstick/tasks/<task_id>/log', 'v1_task_log'), # api v2 Url('/api/v2/yardstick/environments', 'v2_environments'), diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml index 15bbddaa6..046d51731 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml @@ -34,10 +34,10 @@ scenarios: - monitor_type: "process" process_name: "nova-api" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml index fdaaa838a..dfe44ed12 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml @@ -33,10 +33,10 @@ scenarios: - monitor_type: "process" process_name: "neutron-server" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml index fe16f388c..1d553268c 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml @@ -33,10 +33,10 @@ scenarios: - monitor_type: "process" process_name: "keystone" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml index c888967da..33bc5cd5f 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml @@ -33,10 +33,10 @@ scenarios: - monitor_type: "process" process_name: "glance-api" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml index 4ad19f3bd..a13afe3bf 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml @@ -33,10 +33,10 @@ scenarios: - monitor_type: "process" process_name: "cinder-api" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml index da17a59c1..394b98721 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml @@ -33,10 +33,10 @@ scenarios: - monitor_type: "process" process_name: "swift-proxy" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: node1: node1.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml index 3ecbc308c..f987e2b45 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml @@ -32,10 +32,10 @@ scenarios: key: "service-status" process_name: "haproxy" host: node1 - monitor_time: 20 + monitor_time: 30 monitor_number: 3 sla: - max_recover_time: 20 + max_recover_time: 30 - monitor_type: "openstack-cmd" diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml index 7f1dc1010..40e8f9c13 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml @@ -59,9 +59,9 @@ scenarios: - monitor_type: "process" process_name: "rabbitmq-server" host: {{attack_host}} - monitor_time: 20 + monitor_time: 30 sla: - max_recover_time: 20 + max_recover_time: 30 nodes: {{attack_host}}: {{attack_host}}.LF diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml index e9feb97f5..dc0675bec 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml @@ -36,9 +36,9 @@ scenarios: process_name: "neutron-l3-agent" host: {{attack_host}} key: "monitor-recovery" - monitor_time: 20 + monitor_time: 30 sla: - max_recover_time: 20 + max_recover_time: 30 - monitor_type: "general-monitor" diff --git a/yardstick/benchmark/scenarios/compute/qemu_migrate.py b/yardstick/benchmark/scenarios/compute/qemu_migrate.py index 6c0446bb7..6cfedc17a 100644 --- a/yardstick/benchmark/scenarios/compute/qemu_migrate.py +++ b/yardstick/benchmark/scenarios/compute/qemu_migrate.py @@ -106,7 +106,7 @@ class QemuMigrate(base.Scenario): cmd_args = " %s %s %s %s %s %s" %\ (smp, qmp_sock_src, qmp_sock_dst, incoming_ip, migrate_to_port, max_down_time) - cmd = "bash migrate_benchmark.sh %s" % (cmd_args) + cmd = "bash qemu_migrate_benchmark.sh %s" % (cmd_args) LOG.debug("Executing command: %s", cmd) status, stdout, stderr = self.host.execute(cmd) if status: diff --git a/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash index 552098103..d9a440c89 100644 --- a/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash +++ b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash @@ -14,6 +14,7 @@ set -e # Commandline arguments src=$2 +dst=$3 dst_ip=$4 migrate_to_port=$5 max_down_time=$6 @@ -22,7 +23,6 @@ OUTPUT_FILE=/tmp/output-qemu.log do_migrate() { -# local src=`echo $OPTIONS | cut -d ':' -f 2 | cut -d ',' -f 1` echo "info status" | nc -U $src # with no speed limit echo "migrate_set_speed 0" |nc -U $src @@ -45,7 +45,9 @@ output_qemu() # print detail information echo "info migrate" | nc -U $src echo "quit" | nc -U $src + echo "quit" | nc -u $dst sleep 5 + echo "Migration executed successfully" } > $OUTPUT_FILE @@ -64,5 +66,7 @@ echo -e "{ \ main() { do_migrate + output_qemu + output_json } main |