[Pacemaker] About environment variable of Pacemaker processes

Kazunori INOUE inouekazu at intellilink.co.jp
Mon Feb 4 08:29:03 UTC 2013


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

 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




More information about the Pacemaker mailing list