|
|
e1b3f1 |
From 687aa646852d5fd5d4e811b2ec562ebffa15e23d Mon Sep 17 00:00:00 2001
|
|
|
e1b3f1 |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
e1b3f1 |
Date: Thu, 14 Jul 2022 14:52:07 +0200
|
|
|
e1b3f1 |
Subject: [PATCH] ocf-tester: remove deprecated lrmd/lrmadmin code that hasnt
|
|
|
e1b3f1 |
worked since pre-pacemaker days
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
---
|
|
|
e1b3f1 |
tools/ocf-tester.8 | 12 ++-----
|
|
|
e1b3f1 |
tools/ocf-tester.in | 81 ---------------------------------------------
|
|
|
e1b3f1 |
2 files changed, 2 insertions(+), 91 deletions(-)
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
diff --git a/tools/ocf-tester.8 b/tools/ocf-tester.8
|
|
|
e1b3f1 |
index 850ec0be04..3f398282d2 100644
|
|
|
e1b3f1 |
--- a/tools/ocf-tester.8
|
|
|
e1b3f1 |
+++ b/tools/ocf-tester.8
|
|
|
e1b3f1 |
@@ -1,9 +1,9 @@
|
|
|
e1b3f1 |
-.TH OCF-TESTER "8" "January 2012" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
|
|
|
e1b3f1 |
+.TH OCF-TESTER "8" "July 2022" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
|
|
|
e1b3f1 |
.SH NAME
|
|
|
e1b3f1 |
ocf-tester \- Part of the Linux-HA project
|
|
|
e1b3f1 |
.SH SYNOPSIS
|
|
|
e1b3f1 |
.B ocf-tester
|
|
|
e1b3f1 |
-[\fI-LhvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
|
|
|
e1b3f1 |
+[\fI-hvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
|
|
|
e1b3f1 |
.SH DESCRIPTION
|
|
|
e1b3f1 |
Tool for testing if a cluster resource is OCF compliant
|
|
|
e1b3f1 |
.SH OPTIONS
|
|
|
e1b3f1 |
@@ -26,11 +26,6 @@ Name of the resource
|
|
|
e1b3f1 |
\fB\-o\fR name=value
|
|
|
e1b3f1 |
Name and value of any parameters required by the agent
|
|
|
e1b3f1 |
.TP
|
|
|
e1b3f1 |
-\fB\-L\fR
|
|
|
e1b3f1 |
-Use lrmadmin/lrmd for tests
|
|
|
e1b3f1 |
-.PP
|
|
|
e1b3f1 |
-Usage: ocf\-tester [\-Lh] \fB\-n\fR resource_name [\-o name=value]* /full/path/to/resource/agent
|
|
|
e1b3f1 |
-.TP
|
|
|
e1b3f1 |
\fB\-h\fR
|
|
|
e1b3f1 |
This text
|
|
|
e1b3f1 |
.TP
|
|
|
e1b3f1 |
@@ -51,6 +46,3 @@ Name of the resource
|
|
|
e1b3f1 |
.TP
|
|
|
e1b3f1 |
\fB\-o\fR name=value
|
|
|
e1b3f1 |
Name and value of any parameters required by the agent
|
|
|
e1b3f1 |
-.TP
|
|
|
e1b3f1 |
-\fB\-L\fR
|
|
|
e1b3f1 |
-Use lrmadmin/lrmd for tests
|
|
|
e1b3f1 |
diff --git a/tools/ocf-tester.in b/tools/ocf-tester.in
|
|
|
e1b3f1 |
index 10822a5a06..15b14e51ea 100755
|
|
|
e1b3f1 |
--- a/tools/ocf-tester.in
|
|
|
e1b3f1 |
+++ b/tools/ocf-tester.in
|
|
|
e1b3f1 |
@@ -25,8 +25,6 @@
|
|
|
e1b3f1 |
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
|
|
e1b3f1 |
#
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
-LRMD=@libdir@/heartbeat/lrmd
|
|
|
e1b3f1 |
-LRMADMIN=@sbindir@/lrmadmin
|
|
|
e1b3f1 |
DATADIR=@datadir@
|
|
|
e1b3f1 |
METADATA_LINT="xmllint --noout --valid -"
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
@@ -61,7 +59,6 @@ usage() {
|
|
|
e1b3f1 |
echo " -X Turn on RA tracing (expect large output)"
|
|
|
e1b3f1 |
echo " -n name Name of the resource"
|
|
|
e1b3f1 |
echo " -o name=value Name and value of any parameters required by the agent"
|
|
|
e1b3f1 |
- echo " -L Use lrmadmin/lrmd for tests"
|
|
|
e1b3f1 |
exit $1
|
|
|
e1b3f1 |
}
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
@@ -104,7 +101,6 @@ while test "$done" = "0"; do
|
|
|
e1b3f1 |
-o) name=${2%%=*}; value=${2#*=};
|
|
|
e1b3f1 |
lrm_ra_args="$lrm_ra_args $2";
|
|
|
e1b3f1 |
ra_args="$ra_args OCF_RESKEY_$name='$value'"; shift; shift;;
|
|
|
e1b3f1 |
- -L) use_lrmd=1; shift;;
|
|
|
e1b3f1 |
-v) verbose=1; shift;;
|
|
|
e1b3f1 |
-d) export HA_debug=1; shift;;
|
|
|
e1b3f1 |
-X) export OCF_TRACE_RA=1; verbose=1; shift;;
|
|
|
e1b3f1 |
@@ -140,79 +136,6 @@ stopped_rc=7
|
|
|
e1b3f1 |
has_demote=1
|
|
|
e1b3f1 |
has_promote=1
|
|
|
e1b3f1 |
|
|
|
e1b3f1 |
-start_lrmd() {
|
|
|
e1b3f1 |
- lrmd_timeout=0
|
|
|
e1b3f1 |
- lrmd_interval=0
|
|
|
e1b3f1 |
- lrmd_target_rc=EVERYTIME
|
|
|
e1b3f1 |
- lrmd_started=""
|
|
|
e1b3f1 |
- $LRMD -s 2>/dev/null
|
|
|
e1b3f1 |
- rc=$?
|
|
|
e1b3f1 |
- if [ $rc -eq 3 ]; then
|
|
|
e1b3f1 |
- lrmd_started=1
|
|
|
e1b3f1 |
- $LRMD &
|
|
|
e1b3f1 |
- sleep 1
|
|
|
e1b3f1 |
- $LRMD -s 2>/dev/null
|
|
|
e1b3f1 |
- else
|
|
|
e1b3f1 |
- return $rc
|
|
|
e1b3f1 |
- fi
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-add_resource() {
|
|
|
e1b3f1 |
- $LRMADMIN -A $OCF_RESOURCE_INSTANCE \
|
|
|
e1b3f1 |
- ocf \
|
|
|
e1b3f1 |
- `basename $agent` \
|
|
|
e1b3f1 |
- $(basename `dirname $agent`) \
|
|
|
e1b3f1 |
- $lrm_ra_args > /dev/null
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-del_resource() {
|
|
|
e1b3f1 |
- $LRMADMIN -D $OCF_RESOURCE_INSTANCE
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-parse_lrmadmin_output() {
|
|
|
e1b3f1 |
- awk '
|
|
|
e1b3f1 |
-BEGIN{ rc=1; }
|
|
|
e1b3f1 |
-/Waiting for lrmd to callback.../ { n=1; next; }
|
|
|
e1b3f1 |
-n==1 && /----------------operation--------------/ { n++; next; }
|
|
|
e1b3f1 |
-n==2 && /return code:/ { rc=$0; sub("return code: *","",rc); next }
|
|
|
e1b3f1 |
-n==2 && /---------------------------------------/ {
|
|
|
e1b3f1 |
- n++;
|
|
|
e1b3f1 |
- next;
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-END{
|
|
|
e1b3f1 |
- if( n!=3 ) exit 1;
|
|
|
e1b3f1 |
- else exit rc;
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-'
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-exec_resource() {
|
|
|
e1b3f1 |
- op="$1"
|
|
|
e1b3f1 |
- args="$2"
|
|
|
e1b3f1 |
- $LRMADMIN -E $OCF_RESOURCE_INSTANCE \
|
|
|
e1b3f1 |
- $op $lrmd_timeout $lrmd_interval \
|
|
|
e1b3f1 |
- $lrmd_target_rc \
|
|
|
e1b3f1 |
- $args | parse_lrmadmin_output
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-
|
|
|
e1b3f1 |
-if [ "$use_lrmd" = 1 ]; then
|
|
|
e1b3f1 |
- echo "Using lrmd/lrmadmin for all tests"
|
|
|
e1b3f1 |
- start_lrmd || {
|
|
|
e1b3f1 |
- echo "could not start lrmd" >&2
|
|
|
e1b3f1 |
- exit 1
|
|
|
e1b3f1 |
- }
|
|
|
e1b3f1 |
- trap '
|
|
|
e1b3f1 |
- [ "$lrmd_started" = 1 ] && $LRMD -k
|
|
|
e1b3f1 |
- ' EXIT
|
|
|
e1b3f1 |
- add_resource || {
|
|
|
e1b3f1 |
- echo "failed to add resource to lrmd" >&2
|
|
|
e1b3f1 |
- exit 1
|
|
|
e1b3f1 |
- }
|
|
|
e1b3f1 |
-fi
|
|
|
e1b3f1 |
-
|
|
|
e1b3f1 |
-lrm_test_command() {
|
|
|
e1b3f1 |
- action="$1"
|
|
|
e1b3f1 |
- msg="$2"
|
|
|
e1b3f1 |
- debug "$msg"
|
|
|
e1b3f1 |
- exec_resource $action "$lrm_ra_args"
|
|
|
e1b3f1 |
-}
|
|
|
e1b3f1 |
-
|
|
|
e1b3f1 |
test_permissions() {
|
|
|
e1b3f1 |
action=meta-data
|
|
|
e1b3f1 |
debug ${1:-"Testing permissions with uid nobody"}
|
|
|
e1b3f1 |
@@ -233,10 +156,6 @@ test_command() {
|
|
|
e1b3f1 |
action=$1; shift
|
|
|
e1b3f1 |
export __OCF_ACTION=$action
|
|
|
e1b3f1 |
msg=${1:-"Testing: $action"}
|
|
|
e1b3f1 |
- if [ "$use_lrmd" = 1 ]; then
|
|
|
e1b3f1 |
- lrm_test_command $action "$msg"
|
|
|
e1b3f1 |
- return $?
|
|
|
e1b3f1 |
- fi
|
|
|
e1b3f1 |
#echo Running: "export $ra_args; $agent $action 2>&1 > /dev/null"
|
|
|
e1b3f1 |
if [ $verbose -eq 0 ]; then
|
|
|
e1b3f1 |
command_output=`$agent $action 2>&1`
|