diff options
author | wym_libra <yimin.wang@huawei.com> | 2015-12-31 20:02:09 +0800 |
---|---|---|
committer | qi liang <liangqi1@huawei.com> | 2016-01-10 03:23:40 +0000 |
commit | 7f3cc74f9443552631956e2fe61d31bc97106ef5 (patch) | |
tree | c483de22d9abbf14f7ebf932170f666d89e6035a /yardstick/benchmark/scenarios/availability/ha_tools | |
parent | 93e5a8fefd2574de339d2f1ae2041b9d233bbc7b (diff) |
The secondi HA test case-shutdown controller
1) add "attacker_baremetal.py" for fault injection
2) modify the monitor to excute on remote node after ssh connection
3) move all shell scripts together
JIRA: YARDSTICK-182
Change-Id: Ibb9dc908224ddb8b99a0140b75c1a046503f6dfb
Signed-off-by: wym_libra <yimin.wang@huawei.com>
(cherry picked from commit 4f4edd840823ff6a0151e3f5220241183e27e560)
Diffstat (limited to 'yardstick/benchmark/scenarios/availability/ha_tools')
8 files changed, 161 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/check_host_ping.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_host_ping.bash new file mode 100755 index 000000000..0f160e2a8 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/check_host_ping.bash @@ -0,0 +1,27 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# check wether the host is running + +set -e + +host_ip=$1 +shift +options="$@" + +ping -c 1 $options $host_ip | grep ttl | wc -l +EXIT_CODE=$? + +if [ $EXIT_CODE -ne 0 ]; then + exit 1 +else + echo "running" +fi diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/check_openstack_cmd.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_openstack_cmd.bash new file mode 100755 index 000000000..83d7e36c1 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/check_openstack_cmd.bash @@ -0,0 +1,20 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# check the status of a openstack command + +set -e + +cmd=$1 + +source /root/openrc + +exec $cmd diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash new file mode 100755 index 000000000..88baed7d9 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/check_process_python.bash @@ -0,0 +1,18 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# check the status of a service + +set -e + +process_name=$1 + +ps aux | grep -e .*python.*$process_name.* | grep -v grep | wc -l diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/check_service.bash b/yardstick/benchmark/scenarios/availability/ha_tools/check_service.bash new file mode 100755 index 000000000..cc898a859 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/check_service.bash @@ -0,0 +1,18 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# check the status of a service + +set -e + +service_name=$1 + +service $service_name status diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash new file mode 100755 index 000000000..d0e2f1683 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash @@ -0,0 +1,18 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# Stop process by process name + +set -e + +process_name=$1 + +killall -9 $process_name diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/ipmi_power.bash b/yardstick/benchmark/scenarios/availability/ha_tools/ipmi_power.bash new file mode 100755 index 000000000..ea621facd --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/ipmi_power.bash @@ -0,0 +1,21 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# Stop a service and check the service is stoped + +set -e + +ipmi_ip=$1 +ipmi_user=$2 +ipmi_pwd=$3 + +action=$4 +ipmitool -I lanplus -H $ipmi_ip -U $ipmi_user -P $ipmi_pwd power $action diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash b/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash new file mode 100755 index 000000000..c1bf8b7eb --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/start_service.bash @@ -0,0 +1,18 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# Start a service and check the service is started + +set -e + +service_name=$1 + +service $service_name start diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash b/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash new file mode 100755 index 000000000..a8901784e --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/stop_service.bash @@ -0,0 +1,21 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +# Stop a service and check the service is stoped + +set -e + +service_name=$1 + +service $service_name stop + +# TODO +# check the service status |