Hi,

On Wed, Dec 24, 2008 at 02:38:50PM +0100, Raoul Bhatia [IPAX] wrote:
> please find a patch to the mysql ocf ra attached.
> 
> comments:
> 
> 1. writeable piddir:
> > -    if ! su - $OCF_RESKEY_user -c "test -w $piddir"; then
> > +    if ! su -s /bin/sh - $OCF_RESKEY_user -c "test -w $piddir"; then
> 
> if $OCF_RESKEY_user has a invalid shell (e.g. /bin/false), the changes
> introduced in [1] result in a permanent failure.

OK.

> 2. changeset [2] changed the ra's behavior to call mysql_validate() in
> all cases but a request for meta-data and usage/help.
>
> unfortunatly, if datadir is a level below a mount point as shown below,
> the initial monitor action results in a permanent failure. similar
> issues may arise when the binary, pid, ... reside on a directory "below"
> a mountpoint.
> 
> my setup as an example:
> > /dev/drbd1 on /data/mysql type ext3 (rw)
> > datadir: /data/mysql/data/
> > logfile: /data/mysql/logs
> > ...

Sorry for breaking your setup.

> my patch now excludes the monitor action from the validation.

Monitor should return "not running" in this case. See for example
the oracle RA lines 608-619. I applied your patch and then
another one which should properly handle configurations similar
to yours, i.e. when parts of the resource reside on shared
storage. It would be great if you can test these changes.

> as far as
> i reviewed the ra, this shouldn't cause any issues as the bahavior is
> the same as in pre cs 47102f153219.
> 
> as a side note - if we check all parameters, shouldn't we also check for
> the directory/file permissions for log and socket? where is the limit
> on what to check and what not to check inside a ra?

Depends on the nature of the resource. Basically, one should
check everything which could make the later operation of the RA
difficult.

Cheers,

Dejan

> merry christmas,
> raoul
> 
> [1] http://hg.linux-ha.org/dev/diff/a3ca36c22748/resources/OCF/mysql
> [2] http://hg.linux-ha.org/dev/diff/47102f153219/resources/OCF/mysql
> -- 
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bha...@ipax.at
> Technischer Leiter
> 
> IPAX - Aloy Bhatia Hava OEG         web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            off...@ipax.at
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________

> --- /usr/lib/ocf/resource.d/heartbeat/mysql.orig      2008-12-24 
> 13:23:51.000000000 +0100
> +++ /usr/lib/ocf/resource.d/heartbeat/mysql   2008-12-24 13:48:51.000000000 
> +0100
> @@ -274,7 +274,7 @@ mysql_validate() {
>      fi
>  
>      piddir=`dirname $OCF_RESKEY_pid`
> -    if ! su - $OCF_RESKEY_user -c "test -w $piddir"; then
> +    if ! su -s /bin/sh - $OCF_RESKEY_user -c "test -w $piddir"; then
>       ocf_log err "Directory $piddir for pidfile $OCF_RESKEY_pid is not 
> writable by $OCF_RESKEY_user"
>       exit $OCF_ERR_PERM;
>      fi
> @@ -425,9 +425,12 @@ mysql_stop() {
>  }
>  
>  case "$1" in
> -  meta-data) meta_data; exit $OCF_SUCCESS;;
> +  meta-data) meta_data
> +             exit $OCF_SUCCESS;;
>    usage|help)        usage
>               exit $OCF_SUCCESS;;
> +  monitor)   mysql_monitor
> +             exit $?;;
>  esac
>  
>  mysql_validate
> @@ -437,7 +440,6 @@ case "$1" in
>    start)     mysql_start;;
>    stop)              mysql_stop;;
>    status)    mysql_status;;
> -  monitor)   mysql_monitor;;
>    validate-all)      exit $OCF_SUCCESS;;
>  
>   *)          usage

> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to