[ClusterLabs] Antw: Checking valid parameters in crm configure

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu Oct 17 04:22:37 EDT 2019


>>> "Ulrich Windl" <Ulrich.Windl at rz.uni-regensburg.de> schrieb am 17.10.2019
um
10:10 in Nachricht <5DA821F5020000A100034618 at gwsmtp.uni-regensburg.de>:
> (I adjusted the subject for this sub‑thread)
> 
>>>> Xin Liang <XLiang at suse.com> schrieb am 17.10.2019 um 08:48 in Nachricht
> <bbe468be‑6ac5‑0203‑77cf‑c8cab1864881 at suse.com>:
>> Hi Ulrich,
>> 
>> Please try this:
>> crm configure validate‑all <rsc>
> 
> Hi!
> 
> I didn't know that, but the output is uglier than I had expected (I had 
> fixed the Boolean value in the meantime):
> ocf‑exit‑reason:check_params: /run/isredir‑ML1/isredir‑ML1 ‑T returned 3

Some explanation on the above: My RA actually does a semantic check on
parameters in addition to syntax checks (to avoid continuous failures if an
address is in use already), and one of the parameters is an IP address. As the
service in question is already running when checking it, it cannot bind the
requested adress:port, returning 3:

isredir-ML1: 191017 101450.724 (E)setup_listener: failed to bind socket to
172.20.17.238/12503: Cannot assign requested address
isredir-ML1: 191017 101450.724 (E)main: failed to bind socket 1 to
172.20.17.238/0: Cannot assign requested address
isredir-ML1: 191017 101450.724 (I)main: test parameters result is 3

So the 3 is actually mapped to $OCF_ERR_ARGS...

> As my RA outputs this line I guess no output means OK

Actually crm should say that the parameters are considered invalid.

> 
> When I put back the bad value, my RA outputs:
> ocf‑exit‑reason:validate: invalid value true for "logrotate"

So this is _also_ an error.

Regards,#
Ulrich

> 
> So I wonder: Doesn't crm convert the exit code to any output itself? What if

> the RA hadn't used the ocf‑exit‑reason?
> 
> Finally:
> # help validate‑all
> Help for command validate‑all
> 
> Note: This command is not documented.
> Usage: validate‑all rsc
> 
> Regards,
> Ulrich Windl
> 
> 
>> 
>> Thanks!
>> 
>> 
>> On 10/16/19 5:50 PM,  Ulrich Windl  wrote:
>>>>>> Ulrich Windl schrieb am 16.10.2019 um 10:53 in Nachricht <5DA6DA93.232
: 161 
>> :
>>> 60728>:
>>>> Hi!
>>>>
>>>> I just discovered an interesting problem with my own RA that allows a 
>>>> boolean parameter:
>>>> Where is the exact syntax for "boolean" defined, and who's responsible
for 
>>>> checking it? The RA or (e.g.) crm?
>>> 
>>> Inspecting my RA, I realized that my "validate‑all" DOES check the value,
so 
>> it seems crm's validate does not call the RA's validate. Part of my code
is:
>>> 
>>>     if [ "X${logrotate//[^01]/}" != "X${logrotate}" ]; then
>>>         ocf_exit_reason "$me: invalid value $logrotate for \"logrotate\""
>>>         result=$OCF_ERR_CONFIGURED
>>>     fi
>>> 
>>> [...]
>>> 
>>> My test script outputs (I added a new test with an invalid Boolean):
>>> ...
>>> ocf/tester: Using parameter file ocf/isredir‑test3.params
>>> ocf‑exit‑reason:validate: invalid value true for "logrotate"
>>> ocf/tester: Exit status of validate‑all is 6
>>> ocf/tester: Parameter file ocf/isredir‑test3.params done
>>> ...
>>> ocf/tester: Using parameter file ocf/isredir‑test3.params
>>> Beginning tests for ocf/isredir...
>>> * rc=6: Validation failed.  Did you supply enough options with ‑o ?
>>> ocf‑exit‑reason:validate: invalid value true for "logrotate"
>>> Aborting tests
>>> ocf/tester: Exit status is 1
>>> ocf/tester: Parameter file ocf/isredir‑test3.params done
>>> 
>>> 
>>> Regards,
>>> Ulrich
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Manage your subscription:
>>> https://lists.clusterlabs.org/mailman/listinfo/users 
>>> 
>>> ClusterLabs home: https://www.clusterlabs.org/ 
>>> 
>> 
>> ‑‑ 
>> Xin Liang
>> HA team, Beijing
>> https://github.com/liangxin1300 
> 
> 
> 
> 
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users 
> 
> ClusterLabs home: https://www.clusterlabs.org/ 





More information about the Users mailing list