diff options
-rw-r--r-- | api/resources/v1/env.py | 14 | ||||
-rw-r--r-- | api/resources/v2/containers.py | 14 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc055.yaml | 1 | ||||
-rw-r--r-- | tests/unit/orchestrator/test_kubernetes.py | 8 | ||||
-rw-r--r-- | yardstick/benchmark/core/task.py | 2 | ||||
-rwxr-xr-x | yardstick/benchmark/scenarios/networking/netperf.py | 4 | ||||
-rw-r--r-- | yardstick/orchestrator/kubernetes.py | 10 |
7 files changed, 28 insertions, 25 deletions
diff --git a/api/resources/v1/env.py b/api/resources/v1/env.py index 04cc659c7..7c831fd74 100644 --- a/api/resources/v1/env.py +++ b/api/resources/v1/env.py @@ -101,21 +101,15 @@ class V1Env(ApiResource): def _create_data_source(self, ip): url = 'http://admin:admin@{}:{}/api/datasources'.format(ip, consts.GRAFANA_PORT) - influx_conf = utils.parse_ini_file(consts.CONF_FILE) - - try: - influx_url = influx_conf['dispatcher_influxdb']['target'] - except KeyError: - LOG.exception('influxdb url not set in yardstick.conf') - raise + influx_conf = utils.parse_ini_file(consts.CONF_FILE).get('dispatcher_influxdb', {}) data = { "name": "yardstick", "type": "influxdb", "access": "proxy", - "url": influx_url, - "password": "root", - "user": "root", + "url": influx_conf.get('target', ''), + "password": influx_conf.get('password', ''), + "user": influx_conf.get('username', ''), "database": "yardstick", "basicAuth": True, "basicAuthUser": "admin", diff --git a/api/resources/v2/containers.py b/api/resources/v2/containers.py index 66dc94120..ee1903901 100644 --- a/api/resources/v2/containers.py +++ b/api/resources/v2/containers.py @@ -272,21 +272,15 @@ class V2Containers(ApiResource): def _create_data_source(self, ip): url = 'http://admin:admin@{}:{}/api/datasources'.format(ip, 3000) - - influx_conf = utils.parse_ini_file(consts.CONF_FILE) - try: - influx_url = influx_conf['dispatcher_influxdb']['target'] - except KeyError: - LOG.exception('influxdb url not set in yardstick.conf') - raise + influx_conf = utils.parse_ini_file(consts.CONF_FILE).get('dispatcher_influxdb', {}) data = { "name": "yardstick", "type": "influxdb", "access": "proxy", - "url": influx_url, - "password": "root", - "user": "root", + "url": influx_conf.get('target', ''), + "password": influx_conf.get('password', ''), + "user": influx_conf.get('username', ''), "database": "yardstick", "basicAuth": True, "basicAuthUser": "admin", diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc055.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc055.yaml index 7e33741b1..10a7a7108 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc055.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc055.yaml @@ -24,7 +24,6 @@ description: > scenarios: - type: ComputeCapacity - options: nodes: host: {{host}} diff --git a/tests/unit/orchestrator/test_kubernetes.py b/tests/unit/orchestrator/test_kubernetes.py index 51718ab86..1a3291c89 100644 --- a/tests/unit/orchestrator/test_kubernetes.py +++ b/tests/unit/orchestrator/test_kubernetes.py @@ -62,7 +62,10 @@ service ssh restart;while true ; do sleep 10000; done" }, "name": "k8s-86096c30-key" } - ] + ], + "nodeSelector": { + "kubernetes.io/hostname": "node-01" + } } } } @@ -71,7 +74,8 @@ service ssh restart;while true ; do sleep 10000; done" 'command': '/bin/bash', 'args': ['-c', 'chmod 700 ~/.ssh; chmod 600 ~/.ssh/*; \ service ssh restart;while true ; do sleep 10000; done'], - 'ssh_key': 'k8s-86096c30-key' + 'ssh_key': 'k8s-86096c30-key', + 'nodeSelector': { 'kubernetes.io/hostname': 'node-01'} } name = 'host-k8s-86096c30' output_r = KubernetesObject(name, **input_s).get_template() diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index 7e071bc0e..c175a950b 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -125,7 +125,7 @@ class Task(object): # pragma: no cover except KeyboardInterrupt: raise except Exception: - LOG.error('Testcase: "%s" FAILED!!!', case_name, exe_info=True) + LOG.error('Testcase: "%s" FAILED!!!', case_name, exc_info=True) testcases[case_name] = {'criteria': 'FAIL', 'tc_data': []} else: LOG.info('Testcase: "%s" SUCCESS!!!', case_name) diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py index 08d5dd166..a8d9010ed 100755 --- a/yardstick/benchmark/scenarios/networking/netperf.py +++ b/yardstick/benchmark/scenarios/networking/netperf.py @@ -114,6 +114,10 @@ class Netperf(base.Scenario): cmd_args += " %s %s" % (option_pair[1], options[option_pair[0]]) + # Enable IP routing for UDP_STREAM test + if testname == "UDP_STREAM": + cmd_args += " -R 1" + cmd = "sudo bash netperf.sh %s" % (cmd_args) LOG.debug("Executing command: %s", cmd) status, stdout, stderr = self.client.execute(cmd) diff --git a/yardstick/orchestrator/kubernetes.py b/yardstick/orchestrator/kubernetes.py index 9f94fd4ff..198eeac6d 100644 --- a/yardstick/orchestrator/kubernetes.py +++ b/yardstick/orchestrator/kubernetes.py @@ -23,6 +23,7 @@ class KubernetesObject(object): self.command = [kwargs.get('command', '/bin/bash')] self.args = kwargs.get('args', []) self.ssh_key = kwargs.get('ssh_key', 'yardstick_key') + self.node_selector = kwargs.get('nodeSelector', {}) self.volumes = [] @@ -42,7 +43,8 @@ class KubernetesObject(object): }, "spec": { "containers": [], - "volumes": [] + "volumes": [], + "nodeSelector": {} } } } @@ -50,6 +52,7 @@ class KubernetesObject(object): self._change_value_according_name(name) self._add_containers() + self._add_node_selector() self._add_ssh_key_volume() self._add_volumes() @@ -88,6 +91,11 @@ class KubernetesObject(object): return container + def _add_node_selector(self): + utils.set_dict_value(self.template, + 'spec.template.spec.nodeSelector', + self.node_selector) + def _add_volumes(self): utils.set_dict_value(self.template, 'spec.template.spec.volumes', |