Marian,

On 2010-03-02 02:00, Marian Marinov wrote:
> # HG changeset patch
> # User Marian Marinov <[email protected]>
> # Date 1267490738 -7200
> # Branch mysql-ms
> # Node ID 0c1c598c4f5ab4e758f7140b29aab86b2d8cd1a5
> # Parent  7c35f7fc2d3765060579a7c2328d8dc7dc684835
> Medium: RA: mysql: added preference points calculation
> 
> Added preference points calculation during start, stop and monitor actions
> Added do_cmd function (copy from drbd RA).
> 
> Maybe it will be a good idea to move CRM_MASTER and do_cmd to .ocf-shellfuncs

do_cmd is already in .ocf-shellfuncs, except it's called ocf_run. :)

I've fixed that.

> +     # calculate preference points depending on how far behind the master 
> are we
> +     let local_diff=master_pos-local_pos
> +     if [ "$local_diff" -ge 1000 ]; then
> +         points=0;
> +     elif [ "$local_diff" -ge 150 ]; then
> +         let points+=5;
> +     elif [ "$local_diff" -ge 50 ]; then
> +         let points+=25;
> +     elif [ "$local_diff" -ge 25 ]; then
> +         let points+=50;
> +     elif [ "$local_diff" -ge 5 ]; then
> +         let points+=75;
> +     elif [ "$local_diff" -ge 0 ]; then
> +         if [ $local_pos -eq $exec_pos ]; then
> +             let points+=100
> +     else
> +             let points+=90
> +         fi
> +     fi

So firstly, that's another load of bashisms. Secondly; just
"points=<value>" will do here as you are never actually adding up
anything. I simplified that too.

Please pull the mysql-ms branch from
http://hg.linbit.com/florian/linux-ha/agents.

Cheers,
Florian

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to