Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F7609217
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/cts/cts.in b/cts/cts.in
index b299274ae6..c71ce31675 100755
--- a/cts/cts.in
+++ b/cts/cts.in
@@ -1,237 +1,224 @@
#!@BASH_PATH@
#
# Copyright 2012-2025 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
cts_root=`dirname $0`
summary=0
verbose=0
watch=0
-saved=0
tests=""
clean=0
run=0
boot=0
custom_log=""
patterns="-e CTS:"
helpmsg=$(cat <<EOF
Usage: %s [options] {[CMDS]}
[--]help, -h show help screen and exit
-c,-g CLUSTER_NAME set the cluster name
--S show summary from the last CTS run
-s show summary for the current log
-v increase verbosity
-e PATTERN grep pattern to apply when 'summary' or 'watch' requested
-w continous (filtered) monitoring of the log file
-f,-sf FILE show summary for the provided log
-t TEST, [0-9]* add a test to the working set
[--]run request CTS run (passing remaining arguments through)
[--]boot, start request CTS run (with --boot option)
[--]clean request cleaning up after CTS run
-- delimits tests that follow
EOF
)
while true; do
case $1 in
-h|--help|help)
printf "${helpmsg}\n" "$0"
exit
;;
-c|-g)
cluster_name=$2
shift
shift
;;
- -S)
- summary=1
- saved=1
- shift
- ;;
-s)
summary=1
shift
;;
-v)
verbose=`expr $verbose + 1`
shift
;;
-e)
patterns="$patterns -e `echo $2 | sed 's/ /\\\W/g'`"
shift
shift
;;
-w)
watch=1
shift
;;
-f|-sf)
summary=1
custom_log=$2
shift
shift
;;
-t)
tests="$tests $2"
shift
shift
;;
[0-9]*)
tests="$tests $1"
shift
;;
--run|run)
run=1
shift
break
;;
--boot|boot|start)
boot=1
clean=1
shift
break
;;
--clean|clean)
clean=1
shift
;;
--)
shift
tests="$tests $*"
break
;;
"")
break
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# Add the location of this script
export PATH="$PATH:$cts_root"
which cluster-helper &>/dev/null
if [ $? != 0 ]; then
echo $0 needs the cluster-helper script to be in your path
exit 1
fi
which cluster-clean &>/dev/null
if [ $? != 0 ]; then
echo $0 needs the cluster-clean script to be in your path
exit 1
fi
if [ "x$cluster_name" = x ] ; then
clusters=`ls -1 ~/.dsh/group/[a-z]+[0-9] | sed s/.*group.// | tr '\n' ' ' `
echo "custom) interactively define a cluster"
for i in $clusters; do
echo "$i) `cluster-helper --list short -g $i`"
done
read -p "Choose a cluster [custom]: " cluster_name
echo
fi
if [ -z $cluster_name ]; then
cluster_name=custom
fi
case $cluster_name in
custom)
read -p "Cluster name: " cluster_name
read -p "Cluster hosts: " cluster_hosts
read -p "Cluster log file: " cluster_log
cluster-helper add -g "$cluster_name" -w "$cluster_hosts"
;;
*)
cluster_hosts=`cluster-helper --list short -g $cluster_name`
cluster_log=~/cluster-$cluster_name.log
;;
esac
if [ $run = 1 ]; then
clean=1
fi
if [ $clean = 1 ]; then
rm -f $cluster_log
cluster-clean -g $cluster_name --kill
fi
if [ $boot = 1 ]; then
$cts_root/cts-lab -r -c -g $cluster_name --boot
rc=$?
if [ $rc = 0 ]; then
echo "The cluster is ready..."
fi
exit $rc
elif [ $run = 1 ]; then
$cts_root/cts-lab -r -c -g $cluster_name 500 "$@"
exit $?
elif [ $clean = 1 ]; then
exit 0
fi
if [ ! -z $custom_log ]; then
cluster_log=$custom_log
fi
if [ "x$tests" != x ] && [ "x$tests" != "x " ]; then
for t in $tests; do
echo "crm_report --cts-log $cluster_log -d -T $t"
crm_report --cts-log $cluster_log -d -T $t
done
elif [ $summary = 1 ]; then
- files=$cluster_log
- if [ $saved = 1 ]; then
- files=`ls -1tr ~/CTS-*/cluster-log.txt`
- fi
- for f in $files; do
- echo $f
- case $verbose in
- 0)
- cat -n $f | grep $patterns | grep -v "CTS: debug:"
- ;;
- 1)
- cat -n $f | grep $patterns | grep -v "CTS:.* cmd:"
- ;;
- *)
- cat -n $f | grep $patterns
- ;;
- esac
- echo ""
- done
+ echo $cluster_log
+ case $verbose in
+ 0)
+ cat -n $cluster_log | grep $patterns | grep -v "CTS: debug:"
+ ;;
+ 1)
+ cat -n $cluster_log | grep $patterns | grep -v "CTS:.* cmd:"
+ ;;
+ *)
+ cat -n $cluster_log | grep $patterns
+ ;;
+ esac
+ echo ""
elif [ $watch = 1 ]; then
case $verbose in
0)
tail -F $cluster_log | grep $patterns | grep -v "CTS: debug:"
;;
1)
tail -F $cluster_log | grep $patterns | grep -v "CTS:.* cmd:"
;;
*)
tail -F $cluster_log | grep $patterns
;;
esac
fi
# vim: set filetype=sh:
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Oct 15, 11:50 PM (2 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2458067
Default Alt Text
(5 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment