summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/resources/env_action.py30
-rw-r--r--docs/release/release-notes/release-notes.rst89
-rw-r--r--docs/testing/user/userguide/04-installation.rst20
-rwxr-xr-xnsb_setup.sh2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml4
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml4
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc050.yaml20
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml12
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml32
-rw-r--r--tests/unit/benchmark/contexts/test_model.py21
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_scenario_general.py6
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_util.py32
-rw-r--r--yardstick/benchmark/contexts/model.py4
-rwxr-xr-xyardstick/benchmark/runners/base.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py8
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_general.py8
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_process.py8
-rwxr-xr-xyardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash2
-rwxr-xr-xyardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash6
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/nova/create_flavor.bash2
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/nova/delete_flavor.bash2
-rw-r--r--yardstick/benchmark/scenarios/availability/ha_tools/nova/show_flavors.bash2
-rwxr-xr-xyardstick/benchmark/scenarios/availability/ha_tools/start_service.bash16
-rwxr-xr-xyardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash17
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_command.py11
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_process.py3
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/operation_general.py72
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py47
-rw-r--r--yardstick/benchmark/scenarios/availability/scenario_general.py14
-rwxr-xr-xyardstick/benchmark/scenarios/availability/serviceha.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/util.py25
-rw-r--r--yardstick/benchmark/scenarios/compute/cachestat.py2
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py2
-rw-r--r--yardstick/common/openstack_utils.py6
-rw-r--r--yardstick/dispatcher/http.py7
38 files changed, 389 insertions, 169 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index f6f43e5ac..7bfaf27a7 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -199,30 +199,25 @@ def prepareYardstickEnv(args):
def _already_source_openrc():
"""Check if openrc is sourced already"""
return all(os.environ.get(k) for k in ['OS_AUTH_URL', 'OS_USERNAME',
- 'OS_PASSWORD', 'OS_TENANT_NAME',
- 'EXTERNAL_NETWORK'])
+ 'OS_PASSWORD', 'EXTERNAL_NETWORK'])
def _prepare_env_daemon(task_id):
_create_task(task_id)
- installer_ip = os.environ.get('INSTALLER_IP', 'undefined')
- installer_type = os.environ.get('INSTALLER_TYPE', 'undefined')
-
try:
- _check_variables(installer_ip, installer_type)
-
_create_directories()
rc_file = consts.OPENRC
if not _already_source_openrc():
- _get_remote_rc_file(rc_file, installer_ip, installer_type)
+ if not os.path.exists(rc_file):
+ installer_ip = os.environ.get('INSTALLER_IP', '192.168.200.2')
+ installer_type = os.environ.get('INSTALLER_TYPE', 'compass')
+ _get_remote_rc_file(rc_file, installer_ip, installer_type)
+ _source_file(rc_file)
+ _append_external_network(rc_file)
_source_file(rc_file)
- _append_external_network(rc_file)
-
- # update the external_network
- _source_file(rc_file)
_clean_images()
@@ -234,17 +229,6 @@ def _prepare_env_daemon(task_id):
logger.debug('Error: %s', e)
-def _check_variables(installer_ip, installer_type):
-
- if installer_ip == 'undefined':
- raise SystemExit('Missing INSTALLER_IP')
-
- if installer_type == 'undefined':
- raise SystemExit('Missing INSTALLER_TYPE')
- elif installer_type not in consts.INSTALLERS:
- raise SystemExit('INSTALLER_TYPE is not correct')
-
-
def _create_directories():
yardstick_utils.makedirs(consts.CONF_DIR)
diff --git a/docs/release/release-notes/release-notes.rst b/docs/release/release-notes/release-notes.rst
index 669cbf3ab..d89f9ed24 100644
--- a/docs/release/release-notes/release-notes.rst
+++ b/docs/release/release-notes/release-notes.rst
@@ -41,7 +41,7 @@ Version History
| | 3.0 | Yardstick for Danube release |
| | | |
+----------------+--------------------+---------------------------------+
-| | 2.0 | Yardstick for Danube release |
+| May 4th, 2017 | 2.0 | Yardstick for Danube release |
| | | |
+----------------+--------------------+---------------------------------+
| Mar 31st, 2017 | 1.0 | Yardstick for Danube release |
@@ -139,19 +139,19 @@ Release Data
| **Project** | Yardstick |
| | |
+--------------------------------------+--------------------------------------+
-| **Repo/tag** | yardstick/Danube.1.0 |
+| **Repo/tag** | yardstick/Danube.2.0 |
| | |
+--------------------------------------+--------------------------------------+
-| **Yardstick Docker image tag** | Danube.1.0 |
+| **Yardstick Docker image tag** | Danube.2.0 |
| | |
+--------------------------------------+--------------------------------------+
| **Release designation** | Danube |
| | |
+--------------------------------------+--------------------------------------+
-| **Release date** | March 31st, 2017 |
+| **Release date** | May 4th, 2017 |
| | |
+--------------------------------------+--------------------------------------+
-| **Purpose of the delivery** | OPNFV Danube release 1.0 |
+| **Purpose of the delivery** | OPNFV Danube release 2.0 |
| | |
+--------------------------------------+--------------------------------------+
@@ -170,27 +170,8 @@ Documents
Software Deliverables
---------------------
-**Yardstick framework source code <Danube.1.0>**
-+--------------------------------------+--------------------------------------+
-| **Project** | Yardstick |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Repo/tag** | yardstick/Danube.1.0 |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Yardstick Docker image tag** | Danube.1.0 |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Release designation** | Danube |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Release date** | March 31st, 2017 |
-| | |
-+--------------------------------------+--------------------------------------+
-| **Purpose of the delivery** | OPNFV Danube release |
-| | |
-+--------------------------------------+--------------------------------------+
+ - The Yardstick Docker image: https://hub.docker.com/r/opnfv/yardstick (tag: danube.2.0)
**Contexts**
@@ -534,7 +515,7 @@ Feature additions
Scenario Matrix
===============
-For Danube 1.0, Yardstick was tested on the following scenarios:
+For Danube 2.0, Yardstick was tested on the following scenarios:
+-------------------------+---------+---------+---------+---------+
| Scenario | Apex | Compass | Fuel | Joid |
@@ -598,7 +579,9 @@ For Danube 1.0, Yardstick was tested on the following scenarios:
| os-nosdn-kvm_ovs_dpdk | | | X | |
| _bar-noha | | | | |
+-------------------------+---------+---------+---------+---------+
-
+| opnfv_os-ovn-nofeature- | X | | | |
+| noha_daily | | | | |
++-------------------------+---------+---------+---------+---------+
Test results
============
@@ -630,6 +613,52 @@ Known Issues/Faults
Corrected Faults
----------------
+Danube.2.0:
+
++----------------------------+------------------------------------------------+
+| **JIRA REFERENCE** | **SLOGAN** |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-608 | Set work directory in Yardstick container |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-616 | Bugfix: https support should adapt insecure |
+| | situation |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-620 | Yardstick virtualenv support |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-621 | Bugfix: fix query job status in TC074 |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-622 | Bugfix: take test case modification into |
+| | effect in load_images.sh |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-623 | change openrc file path to |
+| | /etc/yardstick/openstack.creds |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-624 | Add opnfv_os-ovn-nofeature-noha_daily test |
+| | suite |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-628 | Bugfix: Make tc019 and tc025 accept |
+| | --task-args options |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-629 | Bugfix: yardstick env prepare cmd do not |
+| | support other installer |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-632 | Bugfix: KeyError when using http dispatcher |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-633 | Bugfix: Environment Compatibility Issues in HA |
+| | Test Cases |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-634 | fix ha issue when run tc050~tc054 in ci |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-635 | Bugfix: Local Openstack Operation in HA test |
+| | frameworks |
++----------------------------+------------------------------------------------+
+
Danube.1.0:
+----------------------------+------------------------------------------------+
@@ -644,7 +673,7 @@ Danube.1.0:
+----------------------------+------------------------------------------------+
-Danube 1.0 known restrictions/issues
+Danube 2.0 known restrictions/issues
====================================
+-----------+-----------+----------------------------------------------+
| Installer | Scenario | Issue |
@@ -662,7 +691,6 @@ Danube 1.0 known restrictions/issues
+-----------+-----------+----------------------------------------------+
-
Open JIRA tickets
=================
@@ -670,6 +698,9 @@ Open JIRA tickets
| **JIRA REFERENCE** | **SLOGAN** |
| | |
+----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-626 | Fio and Lmbench don't work in Ubuntu-arm64 |
+| | image |
++----------------------------+------------------------------------------------+
| JIRA: YARDSTICK-603 | Timeout waiting for floating ip |
| | (which actually pingable) |
+----------------------------+------------------------------------------------+
diff --git a/docs/testing/user/userguide/04-installation.rst b/docs/testing/user/userguide/04-installation.rst
index c1325cab5..0c2bb58cf 100644
--- a/docs/testing/user/userguide/04-installation.rst
+++ b/docs/testing/user/userguide/04-installation.rst
@@ -63,6 +63,10 @@ Prepare the Yardstick container
.. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
+Install docker on your guest system with the following command, if not done yet::
+
+ wget -qO- https://get.docker.com/ | sh
+
Pull the Yardstick Docker image (``opnfv/yardstick``) from the public dockerhub
registry under the OPNFV account: dockerhub_, with the following docker
command::
@@ -146,6 +150,12 @@ In the Yardstick container, the Yardstick repository is located in the ``/home/o
yardstick env prepare
**NOTE**: The above command just works for four OPNFV installers -- **Apex**, **Compass**, **Fuel** and **Joid**.
+The env prepare command may take up to 6-8 minutes to finish building
+yardstick-image and other environment preparation. Meanwhile if you wish to
+monitor the env prepare process, you can enter the Yardstick container in a new
+terminal window and execute the following command::
+
+ tail -f /var/log/yardstick/uwsgi.log
The second way
@@ -267,14 +277,23 @@ Docker image from Docker hub::
Install Yardstick
^^^^^^^^^^^^^^^^^^^^^
+Prerequisite preparation::
+
+ apt-get update && apt-get install -y git python-setuptools python-pip
+ easy_install -U setuptools==30.0.0
+ pip install appdirs==1.4.0
+ pip install virtualenv
+
Create a virtual environment::
virtualenv ~/yardstick_venv
+ export YARDSTICK_VENV=~/yardstick_venv
source ~/yardstick_venv/bin/activate
Download the source code and install Yardstick from it::
git clone https://gerrit.opnfv.org/gerrit/yardstick
+ export YARDSTICK_REPO_DIR=~/yardstick
cd yardstick
./install.sh
@@ -487,4 +506,3 @@ yaml file and add test cases, constraint or task arguments if necessary.
Proxy Support (**Todo**)
---------------------------
-
diff --git a/nsb_setup.sh b/nsb_setup.sh
index 332c0345c..05d1fd6db 100755
--- a/nsb_setup.sh
+++ b/nsb_setup.sh
@@ -241,5 +241,5 @@ else
clear
echo "Installation completed..."
echo "Virtual Environment : $INSTALL_BIN_PATH/yardstick_venv"
-echo "Please Refer README.NSB.rst document on how to get started on VNF testing."
+echo "Please refer to Chapter 13 of the Yardstick User Guide for how to get started with VNF testing."
fi
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml
index ea36b7b38..9b720e17e 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml
@@ -12,6 +12,8 @@ schema: "yardstick:task:0.1"
description: >
Sample test case for the HA of controller node Openstack service.
+{% set file = file or 'etc/yardstick/nodes/fuel_baremetal/pod.yaml' %}
+
scenarios:
-
type: ServiceHA
@@ -50,4 +52,4 @@ scenarios:
context:
type: Node
name: LF
- file: etc/yardstick/nodes/fuel_virtual/pod.yaml
+ file: {{file}}
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
index 4a995fd5a..ec3d1c8d1 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc025.yaml
@@ -12,6 +12,8 @@ schema: "yardstick:task:0.1"
description: >
Sample test case for the HA of OpenStack Controll Node abnormally shutdown.
+{% set file = file or 'etc/yardstick/nodes/fuel_virtual/pod.yaml' %}
+
scenarios:
-
type: ServiceHA
@@ -49,4 +51,4 @@ scenarios:
context:
type: Node
name: LF
- file: etc/yardstick/nodes/fuel_virtual/pod.yaml
+ file: {{file}}
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc050.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc050.yaml
index b1dc31e90..1296c0592 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc050.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc050.yaml
@@ -14,6 +14,10 @@ description: >
This test case is written by new scenario-based HA testing framework.
{% set file = file or 'etc/yardstick/nodes/fuel_baremetal/pod.yaml' %}
+{% set external_net = external_net or 'br-ex' %}
+{% set management_net = management_net or 'br-mgmt' %}
+{% set storage_net = storage_net or 'br-storage' %}
+{% set internal_net = internal_net or 'br-mesh' %}
scenarios:
-
@@ -26,9 +30,9 @@ scenarios:
key: "close-br-public"
attack_key: "close-interface"
action_parameter:
- interface: "br-ex"
+ interface: {{external_net}}
rollback_parameter:
- interface: "br-ex"
+ interface: {{external_net}}
-
fault_type: "general-attacker"
@@ -36,9 +40,9 @@ scenarios:
key: "close-br-mgmt"
attack_key: "close-interface"
action_parameter:
- interface: "br-mgmt"
+ interface: {{management_net}}
rollback_parameter:
- interface: "br-mgmt"
+ interface: {{management_net}}
-
fault_type: "general-attacker"
@@ -46,9 +50,9 @@ scenarios:
key: "close-br-storage"
attack_key: "close-interface"
action_parameter:
- interface: "br-storage"
+ interface: {{storage_net}}
rollback_parameter:
- interface: "br-storage"
+ interface: {{storage_net}}
-
fault_type: "general-attacker"
@@ -56,9 +60,9 @@ scenarios:
key: "close-br-private"
attack_key: "close-interface"
action_parameter:
- interface: "br-mesh"
+ interface: {{internal_net}}
rollback_parameter:
- interface: "br-mesh"
+ interface: {{internal_net}}
monitors:
-
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml
index 6e060b15d..4254e79b6 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc052.yaml
@@ -40,7 +40,6 @@ scenarios:
operation_type: "general-operation"
key: "create-flavor"
operation_key: "nova-create-flavor"
- host: node1
action_parameter:
flavorconfig: "test-001 test-001 100 1 1"
rollback_parameter:
@@ -50,7 +49,6 @@ scenarios:
-
checker_type: "general-result-checker"
key: "check-flavor"
- host: node1
checker_key: "nova-flavor-checker"
expectedValue: "test-001"
condition: "in"
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml
index b6bbb8966..cc5b5cd3e 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml
@@ -34,7 +34,7 @@ scenarios:
host: node1
monitor_time: 20
sla:
- max_recover_time: 30
+ max_recover_time: 20
-
monitor_type: "openstack-cmd"
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
index 2d51a96cc..b9bb889a1 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc054.yaml
@@ -14,6 +14,10 @@ description: >
This test case is written by new scenario-based HA testing framework.
{% set file = file or 'etc/yardstick/nodes/fuel_baremetal/pod.yaml' %}
+{% set vip_management = vip_management or '192.168.0.2' %}
+{% set vip_public = vip_public or '172.16.0.3' %}
+{% set vip_router_management = vip_router_management or '192.168.0.1' %}
+{% set vip_router_public = vip_router_public or '172.16.0.2' %}
scenarios:
-
@@ -43,7 +47,7 @@ scenarios:
sla:
max_outage_time: 5
parameter:
- ip_address: "192.168.0.2"
+ ip_address: {{vip_management}}
-
monitor_type: "general-monitor"
@@ -54,7 +58,7 @@ scenarios:
sla:
max_outage_time: 5
parameter:
- ip_address: "172.16.0.2"
+ ip_address: {{vip_router_public}}
-
monitor_type: "general-monitor"
@@ -65,7 +69,7 @@ scenarios:
sla:
max_outage_time: 5
parameter:
- ip_address: "192.168.0.1"
+ ip_address: {{vip_router_management}}
-
monitor_type: "general-monitor"
@@ -76,7 +80,7 @@ scenarios:
sla:
max_outage_time: 5
parameter:
- ip_address: "172.16.0.3"
+ ip_address: {{vip_public}}
steps:
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
index 97c234e45..d18a4e6d5 100644
--- a/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-nofeature-ha_daily.yaml
@@ -37,9 +37,21 @@ test_cases:
huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
"host": "node4.LF","target": "node5.LF"}'
-
+ file_name: opnfv_yardstick_tc019.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
file_name: opnfv_yardstick_tc045.yaml
constraint:
- installer: fuel
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
-
file_name: opnfv_yardstick_tc046.yaml
constraint:
@@ -47,11 +59,19 @@ test_cases:
-
file_name: opnfv_yardstick_tc047.yaml
constraint:
- installer: fuel
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
-
file_name: opnfv_yardstick_tc048.yaml
constraint:
- installer: fuel
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
-
file_name: opnfv_yardstick_tc049.yaml
constraint:
@@ -63,7 +83,11 @@ test_cases:
-
file_name: opnfv_yardstick_tc051.yaml
constraint:
- installer: fuel
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
-
file_name: opnfv_yardstick_tc052.yaml
constraint:
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index 4a10761f7..122f100de 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -251,4 +251,25 @@ class ServerTestCase(unittest.TestCase):
ports=['some-server-some-network-port'],
user=self.mock_context.user,
key_name=self.mock_context.keypair_name,
+ user_data='',
+ scheduler_hints='hints')
+
+ @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
+ def test__add_instance_with_user_data(self, mock_template):
+ user_data = "USER_DATA"
+ attrs = {
+ 'image': 'some-image', 'flavor': 'some-flavor',
+ 'user_data': user_data,
+ }
+ test_server = model.Server('foo', self.mock_context, attrs)
+
+ test_server._add_instance(mock_template, 'some-server',
+ [], 'hints')
+
+ mock_template.add_server.assert_called_with(
+ 'some-server', 'some-image', 'some-flavor',
+ ports=[],
+ user=self.mock_context.user,
+ key_name=self.mock_context.keypair_name,
+ user_data=user_data,
scheduler_hints='hints')
diff --git a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py
index 593fc77b3..ea54fbb9b 100644
--- a/tests/unit/benchmark/scenarios/availability/test_scenario_general.py
+++ b/tests/unit/benchmark/scenarios/availability/test_scenario_general.py
@@ -48,7 +48,7 @@ class ScenarioGeneralTestCase(unittest.TestCase):
def test_scenario_general_all_successful(self, mock_director):
ins = ScenarioGeneral(self.scenario_cfg, None)
ins.setup()
- ins.run(None)
+ ins.run({})
ins.teardown()
def test_scenario_general_exception(self, mock_director):
@@ -56,7 +56,7 @@ class ScenarioGeneralTestCase(unittest.TestCase):
mock_obj = mock.Mock()
mock_obj.createActionPlayer.side_effect = KeyError('Wrong')
ins.director = mock_obj
- ins.run(None)
+ ins.run({})
ins.teardown()
def test_scenario_general_case_fail(self, mock_director):
@@ -64,5 +64,5 @@ class ScenarioGeneralTestCase(unittest.TestCase):
mock_obj = mock.Mock()
mock_obj.verify.return_value = False
ins.director = mock_obj
- ins.run(None)
+ ins.run({})
ins.teardown()
diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py
new file mode 100644
index 000000000..bb0e6bc79
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/availability/test_util.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2016 Kanglin Yin and others
+# 14_ykl@tongji.edu.cn
+# 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
+##############################################################################
+
+# Unittest for yardstick.benchmark.scenarios.availability.utils
+
+import mock
+import unittest
+
+from yardstick.benchmark.scenarios.availability import util
+
+@mock.patch('yardstick.benchmark.scenarios.availability.util.subprocess')
+class ExecuteShellTestCase(unittest.TestCase):
+
+ def test__fun_execute_shell_command_successful(self, mock_subprocess):
+ cmd = "env"
+ mock_subprocess.check_output.return_value = (0, 'unittest')
+ exitcode, output = util.execute_shell_command(cmd)
+ self.assertEqual(exitcode, 0)
+
+ def test__fun_execute_shell_command_fail_cmd_exception(self, mock_subprocess):
+ cmd = "env"
+ mock_subprocess.check_output.side_effect = RuntimeError
+ exitcode, output = util.execute_shell_command(cmd)
+ self.assertEqual(exitcode, -1)
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 71ee1f3c2..816ec7972 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -150,6 +150,7 @@ class Server(Object): # pragma: no cover
self.context = context
self.public_ip = None
self.private_ip = None
+ self.user_data = ''
if attrs is None:
attrs = {}
@@ -202,6 +203,8 @@ class Server(Object): # pragma: no cover
if "flavor" in attrs:
self._flavor = attrs["flavor"]
+ self.user_data = attrs.get('user_data', '')
+
Server.list.append(self)
@property
@@ -252,6 +255,7 @@ class Server(Object): # pragma: no cover
ports=port_name_list,
user=self.user,
key_name=self.keypair_name,
+ user_data=self.user_data,
scheduler_hints=scheduler_hints)
def add_to_template(self, template, networks, scheduler_hints=None):
diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py
index 7c76e42df..b48ed973a 100755
--- a/yardstick/benchmark/runners/base.py
+++ b/yardstick/benchmark/runners/base.py
@@ -22,6 +22,7 @@ import logging
import multiprocessing
import subprocess
import time
+import os
import traceback
from oslo_config import cfg
@@ -40,7 +41,11 @@ def _output_serializer_main(filename, queue, config):
Use of this process enables multiple instances of a scenario without
messing up the output file.
"""
- out_type = config['yardstick'].get('DEFAULT', {}).get('dispatcher', 'file')
+ try:
+ out_type = config['yardstick'].get('DEFAULT', {})['dispatcher']
+ except KeyError:
+ out_type = os.environ.get('DISPATCHER', 'file')
+
conf = {
'type': out_type.capitalize(),
'file_path': filename
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
index f7683fd84..22de0b645 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
@@ -61,7 +61,7 @@ class BaremetalAttacker(BaseAttacker):
def check(self):
with open(self.check_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0} -W 10".format(self.host_ip),
+ "sudo /bin/sh -s {0} -W 10".format(self.host_ip),
stdin=stdin_file)
LOG.debug("check ret: %s out:%s err:%s",
@@ -74,7 +74,7 @@ class BaremetalAttacker(BaseAttacker):
def inject_fault(self):
exit_status, stdout, stderr = self.connection.execute(
- "shutdown -h now")
+ "sudo shutdown -h now")
LOG.debug("inject fault ret: %s out:%s err:%s",
exit_status, stdout, stderr)
if not exit_status:
@@ -98,12 +98,12 @@ class BaremetalAttacker(BaseAttacker):
if self.jump_connection is not None:
with open(self.recovery_script, "r") as stdin_file:
self.jump_connection.execute(
- "/bin/bash -s {0} {1} {2} {3}".format(
+ "sudo /bin/bash -s {0} {1} {2} {3}".format(
self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
stdin=stdin_file)
else:
_execute_shell_command(
- "/bin/bash -s {0} {1} {2} {3}".format(
+ "sudo /bin/bash -s {0} {1} {2} {3}".format(
self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
stdin=open(self.recovery_script, "r"))
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
index 35cbccd6e..48863af93 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
@@ -64,12 +64,12 @@ class GeneralAttacker(BaseAttacker):
LOG.debug("the shell command is: %s", self.action_param)
with open(self.inject_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- self.action_param,
+ "sudo {}".format(self.action_param),
stdin=stdin_file)
else:
with open(self.inject_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/bash -s ",
+ "sudo /bin/bash -s ",
stdin=stdin_file)
LOG.debug("the inject_fault's exit status is: %s", exit_status)
@@ -85,10 +85,10 @@ class GeneralAttacker(BaseAttacker):
LOG.debug("the shell command is: %s", self.rollback_param)
with open(self.recovery_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- self.rollback_param,
+ "sudo {}".format(self.rollback_param),
stdin=stdin_file)
else:
with open(self.recovery_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/bash -s ",
+ "sudo /bin/bash -s ",
stdin=stdin_file)
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
index dc94a0b17..bff4a6dc3 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
@@ -44,10 +44,10 @@ class ProcessAttacker(BaseAttacker):
def check(self):
with open(self.check_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0}".format(self.service_name),
+ "sudo /bin/sh -s {0}".format(self.service_name),
stdin=stdin_file)
- if stdout and "running" in stdout:
+ if stdout:
LOG.info("check the envrioment success!")
return True
else:
@@ -59,11 +59,11 @@ class ProcessAttacker(BaseAttacker):
def inject_fault(self):
with open(self.inject_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0}".format(self.service_name),
+ "sudo /bin/sh -s {0}".format(self.service_name),
stdin=stdin_file)
def recover(self):
with open(self.recovery_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0} ".format(self.service_name),
+ "sudo /bin/bash -s {0} ".format(self.service_name),
stdin=stdin_file)
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash
index 88baed7d9..96257804f 100755
--- a/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash
@@ -15,4 +15,4 @@ set -e
process_name=$1
-ps aux | grep -e .*python.*$process_name.* | grep -v grep | wc -l
+ps aux | grep -e $process_name | grep -v grep | grep -v /bin/sh | wc -l
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash
index d0e2f1683..e0491b0d5 100755
--- a/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash
@@ -15,4 +15,8 @@ set -e
process_name=$1
-killall -9 $process_name
+if [ "$process_name" = "keystone" ]; then
+ killall -9 -u $process_name
+else
+ killall -9 $process_name
+fi
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/nova/create_flavor.bash b/yardstick/benchmark/scenarios/availability/ha_tools/nova/create_flavor.bash
index 38dbe0cee..941563e7c 100644
--- a/yardstick/benchmark/scenarios/availability/ha_tools/nova/create_flavor.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/nova/create_flavor.bash
@@ -14,6 +14,4 @@
set -e
-source /root/openrc
-
openstack flavor create $1 --id $2 --ram $3 --disk $4 --vcpus $5
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/nova/delete_flavor.bash b/yardstick/benchmark/scenarios/availability/ha_tools/nova/delete_flavor.bash
index 37d2cf6c0..e998464c7 100644
--- a/yardstick/benchmark/scenarios/availability/ha_tools/nova/delete_flavor.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/nova/delete_flavor.bash
@@ -14,6 +14,4 @@
set -e
-source /root/openrc
-
openstack flavor delete $1
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/nova/show_flavors.bash b/yardstick/benchmark/scenarios/availability/ha_tools/nova/show_flavors.bash
index 0b1a9f056..1b0739602 100644
--- a/yardstick/benchmark/scenarios/availability/ha_tools/nova/show_flavors.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/nova/show_flavors.bash
@@ -13,6 +13,4 @@
set -e
-source /root/openrc
-
nova flavor-list \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash b/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash
index c1bf8b7eb..858d86ca0 100755
--- a/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash
@@ -15,4 +15,18 @@ set -e
service_name=$1
-service $service_name start
+Distributor=$(lsb_release -a | grep "Distributor ID" | awk '{print $3}')
+
+if [ "$Distributor" != "Ubuntu" -a "$service_name" != "keystone" -a "$service_name" != "neutron-server" -a "$service_name" != "haproxy" ]; then
+ service_name="openstack-"${service_name}
+elif [ "$Distributor" = "Ubuntu" -a "$service_name" = "keystone" ]; then
+ service_name="apache2"
+elif [ "$service_name" = "keystone" ]; then
+ service_name="httpd"
+fi
+
+if which systemctl 2>/dev/null; then
+ systemctl start $service_name
+else
+ service $service_name start
+fi
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash b/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash
index a8901784e..fd8534e24 100755
--- a/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash
+++ b/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash
@@ -15,7 +15,22 @@ set -e
service_name=$1
-service $service_name stop
+Distributor=$(lsb_release -a | grep "Distributor ID" | awk '{print $3}')
+
+if [ "$Distributor" != "Ubuntu" -a "$service_name" != "keystone" -a "$service_name" != "neutron-server" -a "$service_name" != "haproxy" ]; then
+ service_name="openstack-"${service_name}
+elif [ "$Distributor" = "Ubuntu" -a "$service_name" = "keystone" ]; then
+ service_name="apache2"
+elif [ "$service_name" = "keystone" ]; then
+ service_name="httpd"
+fi
+
+if which systemctl 2>/dev/null; then
+ systemctl stop $service_name
+else
+ service $service_name stop
+fi
+
# TODO
# check the service status
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
index ef07d947d..033a2d721 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
@@ -55,16 +55,7 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor):
def monitor_func(self):
exit_status = 0
- if self.connection:
- with open(self.check_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/bash -s '{0}'".format(self.cmd),
- stdin=stdin_file)
-
- LOG.debug("the ret stats: %s stdout: %s stderr: %s",
- exit_status, stdout, stderr)
- else:
- exit_status, stdout = _execute_shell_command(self.cmd)
+ exit_status, stdout = _execute_shell_command(self.cmd)
if exit_status:
return False
return True
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
index c6c5a75a1..c16765fe0 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
@@ -46,12 +46,12 @@ class GeneralMonitor(basemonitor.BaseMonitor):
if "parameter" in self._config:
with open(self.monitor_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- self.cmd_param,
+ "sudo {}".format(self.cmd_param),
stdin=stdin_file)
else:
with open(self.monitor_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/bash -s ",
+ "sudo /bin/bash -s ",
stdin=stdin_file)
if exit_status:
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
index d2020e31c..31526b011 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
@@ -33,7 +33,7 @@ class MonitorProcess(basemonitor.BaseMonitor):
def monitor_func(self):
with open(self.check_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0}".format(self.process_name),
+ "sudo /bin/sh -s {0}".format(self.process_name),
stdin=stdin_file)
if not stdout or int(stdout) <= 0:
LOG.info("the process (%s) is not running!", self.process_name)
@@ -49,6 +49,7 @@ class MonitorProcess(basemonitor.BaseMonitor):
LOG.error("SLA failure: %f > %f", outage_time, max_outage_time)
return False
else:
+ LOG.info("the sla is passed")
return True
diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
index 49c63cc75..8fd387e47 100644
--- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py
+++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
@@ -14,7 +14,8 @@ from yardstick.benchmark.scenarios.availability.operation.baseoperation \
BaseOperation
import yardstick.ssh as ssh
-from yardstick.benchmark.scenarios.availability.util import buildshellparams
+from yardstick.benchmark.scenarios.availability.util \
+ import buildshellparams, execute_shell_command
LOG = logging.getLogger(__name__)
@@ -25,24 +26,29 @@ class GeneralOperaion(BaseOperation):
def setup(self):
LOG.debug("config:%s context:%s", self._config, self._context)
- host = self._context.get(self._config['host'], None)
+ host = self._context.get(self._config.get('host', None), None)
- self.connection = ssh.SSH.from_node(host, defaults={"user": "root"})
- self.connection.wait(timeout=600)
- LOG.debug("ssh host success!")
+ self.connection = None
+ if host:
+ self.connection = ssh.SSH.from_node(
+ host, defaults={"user": "root"})
+ self.connection.wait(timeout=600)
+ LOG.debug("ssh host success!")
self.key = self._config['key']
self.operation_key = self._config['operation_key']
if "action_parameter" in self._config:
actionParameter = self._config['action_parameter']
- str = buildshellparams(actionParameter)
+ str = buildshellparams(
+ actionParameter, True if self.connection else False)
l = list(item for item in actionParameter.values())
self.action_param = str.format(*l)
if "rollback_parameter" in self._config:
rollbackParameter = self._config['rollback_parameter']
- str = buildshellparams(rollbackParameter)
+ str = buildshellparams(
+ rollbackParameter, True if self.connection else False)
l = list(item for item in rollbackParameter.values())
self.rollback_param = str.format(*l)
@@ -55,15 +61,25 @@ class GeneralOperaion(BaseOperation):
def run(self):
if "action_parameter" in self._config:
- with open(self.action_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- self.action_param,
- stdin=stdin_file)
+ if self.connection:
+ with open(self.action_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo {}".format(self.action_param),
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = \
+ execute_shell_command(
+ "/bin/bash {0} {1}".format(
+ self.action_script, self.action_param))
else:
- with open(self.action_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s ",
- stdin=stdin_file)
+ if self.connection:
+ with open(self.action_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo /bin/sh -s ",
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = execute_shell_command(
+ "/bin/bash {0}".format(self.action_script))
if exit_status == 0:
LOG.debug("success,the operation's output is: %s", stdout)
@@ -74,12 +90,22 @@ class GeneralOperaion(BaseOperation):
def rollback(self):
if "rollback_parameter" in self._config:
- with open(self.rollback_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- self.rollback_param,
- stdin=stdin_file)
+ if self.connection:
+ with open(self.rollback_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo {}".format(self.rollback_param),
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = \
+ execute_shell_command(
+ "/bin/bash {0} {1}".format(
+ self.rollback_script, self.rollback_param))
else:
- with open(self.rollback_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s ",
- stdin=stdin_file)
+ if self.connection:
+ with open(self.rollback_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo /bin/sh -s ",
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = execute_shell_command(
+ "/bin/bash {0}".format(self.rollback_script))
diff --git a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
index ff6017b88..454338175 100644
--- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
+++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
@@ -9,13 +9,13 @@
from __future__ import absolute_import
import logging
-
from yardstick.benchmark.scenarios.availability.result_checker \
.baseresultchecker import \
BaseResultChecker
from yardstick.benchmark.scenarios.availability import Condition
import yardstick.ssh as ssh
-from yardstick.benchmark.scenarios.availability.util import buildshellparams
+from yardstick.benchmark.scenarios.availability.util \
+ import buildshellparams, execute_shell_command
LOG = logging.getLogger(__name__)
@@ -25,11 +25,14 @@ class GeneralResultChecker(BaseResultChecker):
def setup(self):
LOG.debug("config:%s context:%s", self._config, self._context)
- host = self._context.get(self._config['host'], None)
+ host = self._context.get(self._config.get('host', None), None)
- self.connection = ssh.SSH.from_node(host, defaults={"user": "root"})
- self.connection.wait(timeout=600)
- LOG.debug("ssh host success!")
+ self.connection = None
+ if host:
+ self.connection = ssh.SSH.from_node(
+ host, defaults={"user": "root"})
+ self.connection.wait(timeout=600)
+ LOG.debug("ssh host success!")
self.key = self._config['key']
self.resultchecker_key = self._config['checker_key']
@@ -41,7 +44,8 @@ class GeneralResultChecker(BaseResultChecker):
self.key = self._config['key']
if "parameter" in self._config:
parameter = self._config['parameter']
- str = buildshellparams(parameter)
+ str = buildshellparams(
+ parameter, True if self.connection else False)
l = list(item for item in parameter.values())
self.shell_cmd = str.format(*l)
@@ -52,19 +56,32 @@ class GeneralResultChecker(BaseResultChecker):
def verify(self):
if "parameter" in self._config:
- with open(self.verify_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- self.shell_cmd,
- stdin=stdin_file)
+ if self.connection:
+ with open(self.verify_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo {}".format(self.shell_cmd),
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = \
+ execute_shell_command(
+ "/bin/bash {0} {1}".format(
+ self.verify_script,
+ self.rollback_param))
+
LOG.debug("action script of the operation is: %s",
self.verify_script)
LOG.debug("action parameter the of operation is: %s",
self.shell_cmd)
else:
- with open(self.verify_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/bash -s ",
- stdin=stdin_file)
+ if self.connection:
+ with open(self.verify_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "sudo /bin/bash -s ",
+ stdin=stdin_file)
+ else:
+ exit_status, stdout = execute_shell_command(
+ "/bin/bash {0}".format(self.verify_script))
+
LOG.debug("action script of the operation is: %s",
self.verify_script)
diff --git a/yardstick/benchmark/scenarios/availability/scenario_general.py b/yardstick/benchmark/scenarios/availability/scenario_general.py
index a950ef933..689d33a34 100644
--- a/yardstick/benchmark/scenarios/availability/scenario_general.py
+++ b/yardstick/benchmark/scenarios/availability/scenario_general.py
@@ -29,7 +29,7 @@ class ScenarioGeneral(base.Scenario):
def setup(self):
self.director = Director(self.scenario_cfg, self.context_cfg)
- def run(self, args):
+ def run(self, result):
steps = self.scenario_cfg["options"]["steps"]
orderedSteps = sorted(steps, key=lambda x: x['index'])
for step in orderedSteps:
@@ -55,12 +55,14 @@ class ScenarioGeneral(base.Scenario):
self.director.stopMonitors()
if self.director.verify():
- LOG.debug(
- "\033[92m congratulations, "
- "the test cases scenario is pass! \033[0m")
+ result['sla_pass'] = 1
+ LOG.info(
+ "\033[92m Congratulations, "
+ "the HA test case PASS! \033[0m")
else:
- LOG.debug(
- "\033[91m aoh,the test cases scenario failed,"
+ result['sla_pass'] = 0
+ LOG.info(
+ "\033[91m Aoh, the HA test case FAIL,"
"please check the detail debug information! \033[0m")
def teardown(self):
diff --git a/yardstick/benchmark/scenarios/availability/serviceha.py b/yardstick/benchmark/scenarios/availability/serviceha.py
index e82e69b7d..69727de2b 100755
--- a/yardstick/benchmark/scenarios/availability/serviceha.py
+++ b/yardstick/benchmark/scenarios/availability/serviceha.py
@@ -59,20 +59,21 @@ class ServiceHA(base.Scenario):
return
self.monitorMgr.start_monitors()
- LOG.info("monitor start!")
+ LOG.info("HA monitor start!")
for attacker in self.attackers:
attacker.inject_fault()
self.monitorMgr.wait_monitors()
- LOG.info("monitor stop!")
+ LOG.info("HA monitor stop!")
sla_pass = self.monitorMgr.verify_SLA()
if sla_pass:
result['sla_pass'] = 1
+ LOG.info("The HA test case PASS the SLA")
else:
result['sla_pass'] = 0
- assert sla_pass is True, "the test cases is not pass the SLA"
+ assert sla_pass is True, "The HA test case NOT pass the SLA"
return
diff --git a/yardstick/benchmark/scenarios/availability/util.py b/yardstick/benchmark/scenarios/availability/util.py
index 2addef8ef..eadbfa53b 100644
--- a/yardstick/benchmark/scenarios/availability/util.py
+++ b/yardstick/benchmark/scenarios/availability/util.py
@@ -6,14 +6,35 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import logging
+import subprocess
+import traceback
+LOG = logging.getLogger(__name__)
-def buildshellparams(param):
+
+def buildshellparams(param, remote=True):
i = 0
values = []
- result = '/bin/bash -s'
+ result = '/bin/bash -s' if remote else ''
for key in param.keys():
values.append(param[key])
result += " {%d}" % i
i = i + 1
return result
+
+
+def execute_shell_command(command):
+ """execute shell script with error handling"""
+ exitcode = 0
+ output = []
+ try:
+ LOG.debug("the command is: %s", command)
+ output = subprocess.check_output(command, shell=True)
+ except Exception:
+ exitcode = -1
+ output = traceback.format_exc()
+ LOG.error("exec command '%s' error:\n ", command)
+ LOG.error(traceback.format_exc())
+
+ return exitcode, output
diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py
index a365968c7..40f6ed773 100644
--- a/yardstick/benchmark/scenarios/compute/cachestat.py
+++ b/yardstick/benchmark/scenarios/compute/cachestat.py
@@ -97,7 +97,7 @@ class CACHEstat(base.Scenario):
def _filtrate_result(self, result):
fields = []
cachestat = {}
- data_marker = re.compile("\d+")
+ data_marker = re.compile(r"\d+")
ite = 0
average = {'HITS': 0, 'MISSES': 0, 'DIRTIES': 0, 'RATIO': 0,
'BUFFERS_MB': 0, 'CACHE_MB': 0}
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py
index 594c6091e..998463ef6 100644
--- a/yardstick/benchmark/scenarios/compute/cyclictest.py
+++ b/yardstick/benchmark/scenarios/compute/cyclictest.py
@@ -158,7 +158,7 @@ class Cyclictest(base.Scenario):
def run(self, result):
"""execute the benchmark"""
- default_args = "-m -n -q"
+ default_args = "-m -n -q --notrace"
if not self.setup_done:
self.setup()
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index 788de0de4..1f08344e4 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -85,9 +85,13 @@ def get_session():
def get_endpoint(service_type, endpoint_type='publicURL'):
auth = get_session_auth()
+ # for multi-region, we need to specify region
+ # when finding the endpoint
return get_session().get_endpoint(auth=auth,
service_type=service_type,
- endpoint_type=endpoint_type)
+ endpoint_type=endpoint_type,
+ region_name=os.environ.get(
+ "OS_REGION_NAME"))
# *********************************************
diff --git a/yardstick/dispatcher/http.py b/yardstick/dispatcher/http.py
index e3bcbc89b..0d8d2a346 100644
--- a/yardstick/dispatcher/http.py
+++ b/yardstick/dispatcher/http.py
@@ -32,7 +32,7 @@ LOG = logging.getLogger(__name__)
CONF = cfg.CONF
http_dispatcher_opts = [
cfg.StrOpt('target',
- default='http://127.0.0.1:8000/results',
+ default=os.getenv('TARGET', 'http://127.0.0.1:8000/results'),
help='The target where the http request will be sent. '
'If this is not set, no data will be posted. For '
'example: target = http://hostname:1234/path'),
@@ -62,7 +62,8 @@ class HttpDispatcher(DispatchBase):
"description": "yardstick test cases result",
"pod_name": os.environ.get('NODE_NAME', 'unknown'),
"installer": os.environ.get('INSTALLER_TYPE', 'unknown'),
- "version": os.environ.get('YARDSTICK_VERSION', 'unknown')
+ "version": os.environ.get('YARDSTICK_VERSION', 'unknown'),
+ "build_tag": os.environ.get('BUILD_TAG')
}
def record_result_data(self, data):
@@ -75,7 +76,7 @@ class HttpDispatcher(DispatchBase):
'be posted.')
return
- self.result["details"] = self.raw_result
+ self.result["details"] = {'results': self.raw_result}
case_name = ""
for v in self.raw_result: