[DRBD-user] Log STDERR from OCF drbd script

Lars Ellenberg lars.ellenberg at linbit.com
Fri Dec 14 12:20:31 CET 2012

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On Fri, Dec 14, 2012 at 11:49:15AM +0100, Michal Fiala wrote:
> Hallo,
> 
> we are using drbd in corosync/pacemaker cluster. Corosync is logging via
> syslog (to_logfile: no; to_syslog: yes; syslog_facility: local0; debug:
> on). OCF drbd script is using function do_cmd() to execute commands,
> such as drbdadm primary $device. But function do_cmd does not capture
> stderr. If something goes wrong, you can see just return code in log,
> not stderr output, which describes what was wrong.
> 
> from do_cmd() in /usr/lib/ocf/resource.d/linbit/drbd
>         ...
>         cmd_out=$( "$@" )
>         ...
> 
> OCF API defines function ocf_run(), which is very similar to do_cmd(),
> but solves this problem
> 
> from ocf_run() in /usr/lib/ocf/lib/heartbeat/ocf-shellfuncs
>         ...
>         output=`"$@" 2>&1`
>         ...
> 
> Is there a way how to capture stderr from
> /usr/lib/ocf/resource.d/linbit/drbd? I can simply patch ocf script, or
> better this could be a global, permanent fix from developers.

We deliberately chose to do it this way.
Besides the drbd.ocf predates ocf_run(), I think,
and is supposed to also work on clusters not providing this.

The cluster-glue lrmd used to capture both stdout and stderr,
and logged it accordingly.

The pacemaker 1.1.8 rewritten-from-scratch lrmd
apparently does not (yet).

If you "fix" our do_cmd() in the way you propose to,
you'll break the drbd ocf resource agent,
because we use it in nested ways: X=$(do_cmd something else),
and expect *exactly* the stdout of somthing else there.

So don't do that.

If anything, this needs to be fixed in the rewritten-from-scratch
pacemaker lrmd.

	Lars

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
__
please don't Cc me, but send to list   --   I'm subscribed



More information about the drbd-user mailing list