Hi!

I have a question on my own RA. Consider the following code:

    reload)
        if validate; then
            status=$OCF_SUCCESS
            if ! status; then
                ocf_log info "$1: restarting $subject"
                if start; then
                    ocf_log debug "$1: restarting $subject"
                else
                    ocf_exit_reason "$1: failed to restart $subject"
                    status=$OCF_ERR_GENERIC
                fi
            else
                ocf_log info "$1: $subject active already"
            fi
        else
            status=$?
        fi
        exit $status

The crucial point is "status"'s result depends on the current parameters: If 
there was a "reload" due to parameter changes, status will have the new 
parameters and won't see the "old" instance as running, thus just starting the 
new instance. So stopping the old instance would require having the old 
parameters.

I wonder how the correct code would look like.

Despite of that the "unique"ness concept has a problem (compare it to the 
primary key of a database table): It's not possible to express that a 
combination of parameters has to be unique (e.g. IP address, port number, and 
protocol). One could merge them into one string, but that looks ugly.

A similar issue exists for "required"ness of a parameter: Depending on another 
parameter, it could be required, but optional otherwise. Again an ugly solution 
would be to "glue-together" all required parameters, but in the end you would 
end up with one complex parameter that is required, and all the parsing and 
validation checking would happen in the RA. An ugly solution!

(Such issues appear if a resource instance does reflect some kind of setting 
(like a firewall rule) instead of a process that is running)

Regards,
Ulrich



_______________________________________________
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/

Reply via email to