[ClusterLabs] On the semantics of ocf_exit_reason()

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Tue Jul 23 02:17:49 EDT 2019


Hi!

As suggested I'm considering to replace all "ocf_log err ..." preceeding an error exit code with "ocf_exit_reason ..." in my OCF RA.
However I have a question: Is it OK to call ocf_exit_reason more than once before actually exiting? I assume the last message being used will be the one displayed as reason then.
My RA code checks multiple parameters, logging each error (not stopping at the first error if possible), like this:

...
    if [ ! -x $isredir_bin ]; then
        ocf_log err "$me: missing $isredir_bin"
        result=$OCF_ERR_INSTALLED
    fi
    if [ "X${tag//[^-A-Za-z0-9._]/}" != "X${tag}" ]; then
        ocf_log err "$me: invalid value $tag for \"tag\""
        result=$OCF_ERR_ARGS
    fi
    if [ "X${backlog//[^0-9]/}" != "X${backlog}" ]; then
        ocf_log err "$me: invalid value $backlog for \"backlog\""
        result=$OCF_ERR_ARGS
    fi
    if [ -z "$dest_tsap" ]; then
        ocf_log err "$me: missing value for \"dest\""
        result=$OCF_ERR_ARGS
    elif [ "X${dest_tsap//[^-A-Za-z0-9._\\/]/}" != "X${dest_tsap}" ]; then
        ocf_log err "$me: invalid value $dest_tsap for \"dest\""
        result=$OCF_ERR_ARGS
    fi
...

Regards,
Ulrich




More information about the Users mailing list