Page MenuHomeClusterLabs Projects

No OneTemporary

diff --git a/cts/OCFDummy2.in b/cts/OCFDummy2.in
deleted file mode 100755
index e25b5c8cfc..0000000000
--- a/cts/OCFDummy2.in
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/bin/sh
-#
-# License: GNU General Public License (GPL)
-# Support: linux-ha@lists.linux-ha.org
-#
-#
-# WARNING: this script is for CTS testing only.
-#
-# This script support master-slave operations
-# It writes the instance information to a file named $DUMMY_RESOURCE,
-# in the following format:
-#
-# INSTANCE state running status
-# instance0 slave running
-# instance1 master failed
-#
-#
-# start: append a line to the file,
-# or change the running status if the resource instance exist.
-# stop: remove the instance from the file
-# promote/demote: change the state
-# notify: do nothing
-#
-#
-# besides, all opertions will sleep for 1 second by default
-#
-
-. @hb_libdir@/ocf-shellfuncs
-
-AWK=gawk
-
-CRM_MASTER="/usr/sbin/crm_master"
-DUMMY_RESOURCE="/tmp/OCFDummyMasterSlave:resource"
-DUMMY_LOGFILE="/var/log/OCFDummyMasterSlave.log"
-
-start_delay=1
-stop_delay=1
-monitor_delay=1
-promote_delay=1
-demote_delay=1
-notify_delay=1
-
-dummy_log () {
- echo `date +%T` $1 $2 $3 >> $DUMMY_LOGFILE
-}
-
-do_cmd() {
- local cmd="$*"
- ocf_log debug "$RESOURCE: Calling $cmd"
- local cmd_out=$($cmd 2>&1)
- ret=$?
-
- if [ $ret -ne 0 ]; then
- ocf_log err "$RESOURCE: Called $cmd"
- ocf_log err "$RESOURCE: Exit code $ret"
- ocf_log err "$RESOURCE: Command output: $cmd_out"
- else
- ocf_log debug "$RESOURCE: Exit code $ret"
- ocf_log debug "$RESOURCE: Command output: $cmd_out"
- fi
-
- echo $cmd_out
- return $ret
-}
-
-
-dummy_get_status() {
- instance="instance$1"
- grep $instance $DUMMY_RESOURCE 2>&1 >/dev/null
- if [ ! $? -eq 0 ]; then
- echo "$instance not running"
- return $OCF_NOT_RUNNING
- fi
- grep $instance $DUMMY_RESOURCE | grep "master" 2>&1 >/dev/null
- state=$?
- grep $instance $DUMMY_RESOURCE | grep "running" 2>&1 >/dev/null
- running=$?
-
- if [ $state -eq 0 ]; then # master
- if [ $running -eq 0 ]; then
- echo "$instance is running as master"
- return $OCF_RUNNING_MASTER
- else
- echo "$instance is master, error"
- return $OCF_FAILED_MASTER
- fi
- else # slave
- if [ $running -eq 0 ]; then
- echo "$instance is running as slave"
- return $OCF_SUCCESS
- else
- echo "%instance is slave, error"
- return $OCF_ERR_GENERIC
- fi
- fi
-}
-
-
-do_start_resource () {
- instance="instance$1"
- state=$2
- grep $instance $DUMMY_RESOURCE 2>&1 > /dev/null
- if [ $? -eq 0 ]; then # found instance
- regexp="s/$instance.*/$instance $state running/"
- cat $DUMMY_RESOURCE | sed -e "$regexp" > $DUMMY_RESOURCE
- else # instance not exist
- echo -e "$instance $state running" >> $DUMMY_RESOURCE
- fi
- return $OCF_SUCCESS
-}
-
-# stop, delete instance from the file
-do_stop_resource () {
- instance="instance$1"
- cat $DUMMY_RESOURCE | grep -v $instance > $DUMMY_RESOURCE
- return $OCF_SUCCESS
-}
-
-do_change_state() {
- instance="instance"$1
- state=$2
- regexp="s/$instance .* \(.*\)/$instance $state \1/"
- cat $DUMMY_RESOURCE | sed -e "$regexp" > $DUMMY_RESOURCE
-}
-
-
-dummy_start() {
- touch $DUMMY_RESOURCE
- sleep $start_delay
- dummy_log "do_start_resource $OCF_RESKEY_clone slave"
- do_start_resource $OCF_RESKEY_clone "slave"
- if [ $OCF_RESKEY_clone -eq 0 ]; then
- do_cmd $CRM_MASTER -D
- do_cmd $CRM_MASTER -v 1000
- fi
- return $OCF_SUCCESS
-}
-
-dummy_stop() {
- touch $DUMMY_RESOURCE
- sleep $stop_delay
- dummy_log "do_stop_resource $OCF_RESKEY_clone"
- do_stop_resource $OCF_RESKEY_clone
- return $OCF_SUCCESS
-}
-
-dummy_monitor() {
- dummy_log "monitor instance $OCF_RESKEY_clone"
- touch $DUMMY_RESOURCE
- sleep $monitor_delay
- dummy_get_status $OCF_RESKEY_clone
-}
-
-dummy_promote() {
- dummy_log "promote instance $OCF_RESKEY_clone"
- touch $DUMMY_RESOURCE
- sleep $promote_delay
- do_change_state $OCF_RESKEY_clone "master"
-}
-
-dummy_demote() {
- dummy_log "demote instance $OCF_RESKEY_clone"
- touch $DUMMY_RESOURCE
- sleep $demote_delay
- do_change_state $OCF_RESKEY_clone "slave"
-}
-
-dummy_notify() {
- dummy_log "notify instance $OCF_RESKEY_clone"
- touch $DUMMY_RESOURCE
- sleep $notify_delay
- local n_type="$OCF_RESKEY_notify_type"
- local n_op="$OCF_RESKEY_notify_operation"
- set -- $n_active_resource
- local n_active="$#"
- set -- $notify_stop_resource
- local n_stop="$#"
- set -- $notify_start_resource
- local n_start="$#"
-
- ocf_log debug "$RESOURCE notify: $n_type for $n_op - counts: active $n_active - starting $n_start - stopping $n_stop"
- case $n_type in
- pre)
- case $n_op in
- promote) # TODO:
- # Resist promotion of the other side in case we
- # are already primary - though the CRM should
- # not even attempt that.
- ;;
- esac
- ;;
- post)
- case $n_op in
- start)
- ;;
- # TODO: Does "fence" actually happen?
- stop|fence)
- # This MUST be a notification for the other side
- # having been stopped, because for sure we won't
- # receive one for ourselves being stopped ;-)
- # So to allow continuing with freeze_io, we need
- # to explicitly disconnect.
- ;;
- monitor)
- # TODO: We don't get notifications for failed
- # monitors yet.
- ;;
- esac
- ;;
- esac
- return $OCF_SUCCESS
-}
-
-
-if
- [ $# -ne 1 ]
-then
- echo "$0 start|stop|status|monitor|promote|demote|notify"
- exit $OCF_ERR_ARGS
-fi
-
-case $1 in
- start) dummy_start ;;
- stop) dummy_stop ;;
- monitor) dummy_monitor ;;
- promote) dummy_promote ;;
- demote) dummy_demote ;;
- notify) dummy_notify ;;
- *) exit $OCF_ERR_ARGS ;;
-esac

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jul 8, 6:44 PM (2 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2002783
Default Alt Text
(6 KB)

Event Timeline