[Pacemaker] About environment variable of Pacemaker processes

Andrew Beekhof andrew at beekhof.net
Mon Feb 4 23:42:57 UTC 2013


On Mon, Feb 4, 2013 at 7:29 PM, Kazunori INOUE
<inouekazu at intellilink.co.jp> wrote:
> Hi,
>
> In the environment where variable LANG was set,
> when pacemaker was started by 'service', the LANG was taken over to Pacemaker processes.
> Therefore the result of the command executed in STONITH plugin is outputted in LANG.
>
> - pacemaker-1.1 : 8fb2c2f1a4 (the latest devel)
> - glue : 54ec848c43
> - RHEL6.3
>
>
> I checked the environment variable LANG and LC_ALL of the Pacemaker processes.
> In my environment, LANG is taken over to stonithd etc.
>
> $ env | egrep 'LANG|LC_ALL'
> LANG=ja_JP.UTF-8
> $ service pacemaker start
>
> $ cat /proc/`pidof pacemakerd`/environ | tr '\0' '\n' | egrep 'LANG|LC_ALL'
> LANG=ja_JP.UTF-8
> $ cat /proc/`pidof stonithd`/environ | tr '\0' '\n' | egrep 'LANG|LC_ALL'
> LANG=ja_JP.UTF-8
>
> As a result, for example, the result of the 'virsh' in libvirt (plugin) returns in Japanese.
>  * http://hg.linux-ha.org/glue/file/54ec848c439e/lib/plugins/stonith/external/libvirt#l80
> Therefore the subsequent 'egrep' never matches it. ('egrep' never returns 0 as exit status.)
>
> There may be other similar problems..  How about the following patches?
>
>
> a) set LC_ALL in /etc/init.d/pacemaker
>
>  mcp/pacemaker.in |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mcp/pacemaker.in b/mcp/pacemaker.in
> index 1d71a04..ad12f6a 100644
> --- a/mcp/pacemaker.in
> +++ b/mcp/pacemaker.in
> @@ -27,6 +27,7 @@ cman=0
>
>  # set secure PATH
>  PATH="/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@"
> +LC_ALL=C
>
>  checkrc() {
>      if [ $? = 0 ]; then
>
>
> b) OR set LC_ALL in pacemakerd

I think this is the better option as it will work regardless of how
pacemaker is started (upstart/systemd/newfadX).

>
>  mcp/pacemaker.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
> index 08bd172..f06d306 100644
> --- a/mcp/pacemaker.c
> +++ b/mcp/pacemaker.c
> @@ -804,6 +804,7 @@ main(int argc, char **argv)
>      qb_ipcs_service_t *ipcs = NULL;
>      const char *facility = daemon_option("logfacility");
>
> +    setenv("LC_ALL", "C", 1);
>      set_daemon_option("mcp", "true");
>      set_daemon_option("use_logd", "off");
>
>
> Best Regards,
> Kazunori INOUE
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list