diff options
-rw-r--r-- | api/resources/env_action.py | 30 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml | 2 | ||||
-rwxr-xr-x | yardstick/benchmark/runners/base.py | 7 | ||||
-rwxr-xr-x | yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash | 2 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/compute/cachestat.py | 2 | ||||
-rw-r--r-- | yardstick/dispatcher/http.py | 7 |
6 files changed, 20 insertions, 30 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/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/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/ha_tools/check_process_python.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash index 88baed7d9..7c275f7ce 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 | wc -l diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py index b4c3463e5..8873b9683 100644 --- a/yardstick/benchmark/scenarios/compute/cachestat.py +++ b/yardstick/benchmark/scenarios/compute/cachestat.py @@ -103,7 +103,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/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: |