aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick')
-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
24 files changed, 191 insertions, 91 deletions
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: