Hi,

On Fri, Nov 14, 2008 at 09:13:54AM +0100, Marc Cousin wrote:
> Hi, 
> 
> I've been fighting with the OCF DRBD script returning me success when trying 
> to get a resource secondary, when it failed : the drbdadm secondary command 
> fails (returns 11) and the drbd script returns 0. It's with heartbeat 2.1.4.
> 
> I think I've located the culprit :
> 
> do_drbdadm() { 
> ?????????????? local cmd="$DRBDADM -c $DRBDCONF $*" 
> ?????????????? ocf_log debug "$RESOURCE: Calling $cmd" 
> ?????????????? local cmd_out=$($cmd 2>&1) 
> ?????????????? ret=$? 
> ?????????????? # Trim the garbage drbdadm likes to print when using the node 
> ?????????????? # override feature: 
> ?????????????? local cmd_ret=$(echo $cmd_out | sed -e 's/found 
> __DRBD_NODE__.*<<//;') 
> ?????????????? if [ $ret -ne 0 ]; then 
> ?????????????????????????????? ocf_log err "$RESOURCE: Called $cmd" 
> ?????????????????????????????? ocf_log err "$RESOURCE: Exit code $ret" 
> ?????????????????????????????? ocf_log err "$RESOURCE: Command output: 
> $cmd_ret" 
> ?????????????? else 
> ?????????????????????????????? ocf_log debug "$RESOURCE: Exit code $ret" 
> ?????????????????????????????? ocf_log debug "$RESOURCE: Command output: 
> $cmd_ret" 
> ?????????????? fi 
> ?????????????? echo $cmd_ret 
> ?????????????? return $ret 
> }
> 
> 
>         local cmd_out=$($cmd 2>&1) 
>         ret=$? 
> 
> In this case $? always is 0. As I don't know sh that much (and hate it a 
> lot :) ), I've been trying to find the reason, and as soon as I remove 
> the 'local', the return code is transmitted to $? again.

True. Interesting that nobody found this before.

> This is quite an important problem I think, because whenever heartbeat fails 
> to do a drbd command, it thinks it has worked (instead of retrying).

Fixed in the development repository.

Cheers,

Dejan

> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to