[ClusterLabs] Antw: Re: Announcing ClusterLabs Summit 2020

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Wed Nov 6 02:22:58 EST 2019


>>> Valentin Vidic <vvidic at valentin-vidic.from.hr> schrieb am 05.11.2019 um
20:35
in Nachricht <20191105193555.GG27497 at valentin-vidic.from.hr>:
> On Mon, Nov 04, 2019 at 08:07:51PM ‑0600, Ken Gaillot wrote:
>> A reminder: We are still interested in ideas for talks, and rough
>> estimates of potential attendees. "Maybe" is perfectly fine at this
>> stage. It will let us negotiate hotel rates and firm up the location
>> details.
> 
> Not sure if I would be able to attend but I would be interested to
> know if there is some framework for release testing resource agents?
> Something along the lines:
> 
> ‑ bring up 3 VMs
> ‑ configure a cluster using ansible for service X
> ‑ destroy node2
> ‑ wait some time
> ‑ check if the service is still available

Nothing like that, but I wrote thios wrapper to do some pre-release testing
for my RAs:
The first parameter is the RA name (required)
If followed by "debug" the script is run by "bash -x"
If followed by "manual" the following parameter is the action to test
If no parameters follow ocf-tester is used

The actual parameters are written to files named "ocf/${BASE}-test*.params"
($BASE is the RA name, and it's expected that the testing RA (not inmstalled
yet) lives in sub-directory ocf/). The parameter files by themselves contain
lines like "name=value" like this example, and the tests are performed in
"shell order":

dest="www/80"
source="localhost/0"
tag="HA"
mask="I"
logging="F"
log_format="TL"
options="K:120"

And finally the script (local commit 39030162, just for reference. You'll have
to replace "xola" with the proper prefix to use RAs installed already):
> cat tester
#!/bin/sh
# wrapper script to test OCF RA
if [ $# -lt 1 ]; then
    echo "$0: missing base" >&2
    exit 1
fi
BASE="$1"; shift
for ra in "ocf/$BASE" "/usr/lib/ocf/resource.d/xola/$BASE"
do
    if [ -e "$ra" ]; then
        RA="$ra"
        break
    fi
done
INSTANCE="$BASE"
PARAM_FILES="ocf/${BASE}-test*.params"
if [ X"$RA" = X ]; then
    echo "$0: RA $BASE not found" >&2
    exit 1
fi
case "$1" in
    debug)
        DEBUG="bash -x"
        MODE=$1
        shift
        ;;
    manual)
        MODE=$1
        shift
        ;;
    *)
        MODE=AUTO
esac
echo "$0: Using $INSTANCE ($RA) in $MODE mode"
for PARAM_FILE in $PARAM_FILES
do
    echo "$0: Using parameter file $PARAM_FILE"
    if [ $MODE != AUTO ]; then
        for action
        do
            eval OCF_ROOT=/usr/lib/ocf OCF_RESOURCE_INSTANCE="$INSTANCE" \
                $(sed -ne 's/^\([^#=]\+=.\+\)$/OCF_RESKEY_\1/p' "$PARAM_FILE")
\
                $DEBUG $RA "$action"
            echo "$0: Exit status of $action is $?"
        done
    else
        if [ $# -eq 0 ]; then
            eval /usr/sbin/ocf-tester -n "$INSTANCE" \
                $(sed -ne 's/^\([^#=]\+=.\+\)$/-o \1/p' "$PARAM_FILE") \
                $RA
            echo "$0: Exit status is $?"
        else
            echo "$0: Extra parameters: $@" >&2
        fi
    fi
    echo "$0: Parameter file $PARAM_FILE done"
done
###

Regards,
Ulrich

> 
> ‑‑ 
> Valentin
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users 
> 
> ClusterLabs home: https://www.clusterlabs.org/ 





More information about the Users mailing list