[DRBD-user] Log STDERR from OCF drbd script

Michal Fiala fiala at mfiala.net
Fri Dec 14 11:49:15 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.


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.



More information about the drbd-user mailing list