[ClusterLabs] Overhaul of the OCF resource agent api spec

Kristoffer Grönlund kgronlund at suse.com
Wed Feb 11 07:49:34 UTC 2015


Lars Ellenberg <lars.ellenberg at linbit.com> writes:

> * enrich parameter definitions
>
>   - more specific data types
>     - integers, possibly valid value ranges
>     - enums (choices of predefined strings)
>   - optional "value-validation-pcre" regular expression?

To expand on this bit:

Marek Grac proposed adopting the additions to the OCF standard used by
the fence-agents. I don't remember the exact list, but the dummy fence
agent demonstrates some of them [1].

I suggested adding some form of validation support for
parameters. However, I suspect that simply adding a validation RE would
not be sufficient (since you might want to validate something that
doesn't easily lend it to REs, like an email address).

Rationale
----------

User interfaces want to be able to show immediately whether a value has
been entered correctly, so being able to validate each parameter in
particular is important for the user experience. The current 'validate'
action is fine, but doesn't quite work for this. However, I don't
propose removing the action, it is still useful for validation the
complete configuration as well as performing more extensive validation
like checking if a configured device really exists and so on.

Proposal
---------

I would propose two things:

1. Extend the list of supported content types to include more
fine-grained types than the current list. Here are some suggestions:

 * IP address / Domain name
 * Port
 * Integer range (<min>-<max>)
 * File name
 * Directory name
 * Device
 * Email address
 * List of possible choices (The proposed select tag)
 * Boolean (This is already in use in resource-agents, but is it in the standard?)

2. For values that do not fit any of the above types, a <validate> tag
with a regex attribute. The idea being that other forms of validations
may be added if desired by adding attributes to the validate tag.

Example:

<parameter name="time" unique="0" required="1">
  <longdesc lang="en">
  Max time of operation.
  </longdesc>
  <shortdesc lang="en">Time of operation</shortdesc>
  <content type="string"/>
  <validate regex="[0-9]+[s|ms|m|h]?"/>
</parameter>

Semantics
---------

My suggestion is to make the validate tag optional and leave the
semantics up to UIs and applications.

[1]: https://git.fedorahosted.org/cgit/fence-agents.git/tree/fence/agents/dummy/fence_dummy.py

-- 
// Kristoffer Grönlund
// kgronlund at suse.com




More information about the Users mailing list