Skip to content

Commit

Permalink
Merge pull request #30 from linux-ha-japan/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
Yusuke Iida committed Mar 30, 2016
2 parents 78ae790 + 5834d1c commit 22e30f7
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 79 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.59])
AC_INIT([pm_logconv-cs], [2.1])
AC_INIT([pm_logconv-cs], [2.2])
AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr)
PM_PKG="pacemaker"
Expand Down
2 changes: 2 additions & 0 deletions init/pm_logconv.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ WantedBy=multi-user.target
[Service]
ExecStart=/usr/share/pacemaker/pm_logconv/pm_logconv.py
Restart=always

ExecStopPost=/bin/sh -c '[ ! -f /etc/pm_logconv.conf ] && systemctl stop pm_logconv.service'
6 changes: 6 additions & 0 deletions init/pm_logconv_init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ start on runlevel [2345] and started rsyslog
stop on runlevel [06]
respawn
exec /usr/share/pacemaker/pm_logconv/pm_logconv.py

post-stop script
if [ ! -f /etc/pm_logconv.conf ]; then
stop ; exit 0
fi
end script
60 changes: 30 additions & 30 deletions pm_logconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2202,7 +2202,7 @@ def try_to_operate(self, outputobj, logelm, lconvfrm):
try:
# In the case of example above, tmp's value is
# "op=master_slave_Stateful0:1_promote_0".
tmp = logelm.halogmsg.split()[3]
tmp = logelm.halogmsg.split()[2]
# remove "op=" at the head.
opid = tmp[3:]
rscid, op = self.parse_opid(opid)[:2]
Expand Down Expand Up @@ -2265,8 +2265,8 @@ def operation_succeeded(self, outputobj, logelm, lconvfrm):
}
try:
wordlist = logelm.halogmsg.split()
rscid, op = self.parse_opid(wordlist[2])[:2]
rcstr = self.trimmark(wordlist[6],"=")
rscid, op = self.parse_opid(wordlist[1])[:2]
rcstr = self.trimmark(wordlist[5],"=")
except:
return CONV_PARSE_ERROR
if self.is_empty(rscid, op, rcstr):
Expand Down Expand Up @@ -2326,7 +2326,7 @@ def operation_succeeded(self, outputobj, logelm, lconvfrm):
def operation_failed(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
rscid, op = self.parse_opid(wordlist[2])[:2]
rscid, op = self.parse_opid(wordlist[1])[:2]
idx = logelm.halogmsg.find("rc=")
if idx == -1:
idx = logelm.halogmsg.find("status=")
Expand Down Expand Up @@ -2369,7 +2369,7 @@ def operation_failed(self, outputobj, logelm, lconvfrm):
'''
def operation_timedout_ocf(self, outputobj, logelm, lconvfrm):
try:
opid = logelm.halogmsg.split()[2]
opid = logelm.halogmsg.split()[1]
rscid, op = self.parse_opid(opid)[:2]
except:
return CONV_PARSE_ERROR
Expand All @@ -2393,8 +2393,8 @@ def operation_timedout_ocf(self, outputobj, logelm, lconvfrm):
def detect_rsc_failure(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
rscid = self.parse_opid(wordlist[2])[0]
rcstr = self.trimmark(wordlist[7],"=")
rscid = self.parse_opid(wordlist[1])[0]
rcstr = self.trimmark(wordlist[6],"=")
except:
return CONV_PARSE_ERROR
if self.is_empty(rscid, rcstr):
Expand All @@ -2420,8 +2420,8 @@ def detect_rsc_failure(self, outputobj, logelm, lconvfrm):
def node_status_updated(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
nodename = wordlist[1]
status = wordlist[4]
nodename = wordlist[0]
status = wordlist[3]
except:
return CONV_PARSE_ERROR
if self.is_empty(nodename, status):
Expand All @@ -2446,8 +2446,8 @@ def node_status_updated(self, outputobj, logelm, lconvfrm):
'''
def node_status_determined(self, outputobj, logelm, lconvfrm):
try:
nodename = logelm.halogmsg.split()[2]
nodestat = logelm.halogmsg.split()[4]
nodename = logelm.halogmsg.split()[1]
nodestat = logelm.halogmsg.split()[3]
except:
return CONV_PARSE_ERROR

Expand Down Expand Up @@ -2800,7 +2800,7 @@ def add_rsc_start(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
nodename = self.trimmark(wordlist[-1])
rscid = wordlist[2]
rscid = wordlist[1]
except:
return CONV_PARSE_ERROR
if self.is_empty(nodename, rscid):
Expand Down Expand Up @@ -2829,7 +2829,7 @@ def add_rsc_start(self, outputobj, logelm, lconvfrm):
def add_rsc_stop(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
rscid = wordlist[2]
rscid = wordlist[1]
except:
return CONV_PARSE_ERROR
if self.is_empty(rscid):
Expand Down Expand Up @@ -2877,11 +2877,11 @@ def add_rsc_stop(self, outputobj, logelm, lconvfrm):
def add_no_action(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
rscid = wordlist[2]
status = self.trimmark(wordlist[3])
rscid = wordlist[1]
status = self.trimmark(wordlist[2])
node = ""
if len(wordlist) >= 5:
node = self.trimmark(wordlist[4])
if len(wordlist) >= 4:
node = self.trimmark(wordlist[3])
except:
return CONV_PARSE_ERROR
if self.is_empty(rscid, status):
Expand Down Expand Up @@ -2922,7 +2922,7 @@ def add_rsc_move(self, outputobj, logelm, lconvfrm):
wordlist = logelm.halogmsg.split()
a_nodename = self.trimmark(wordlist[-1])
f_nodename = self.trimmark(wordlist[-3])
rscid = wordlist[2]
rscid = wordlist[1]
except:
return CONV_PARSE_ERROR

Expand Down Expand Up @@ -2958,7 +2958,7 @@ def rsc_init_action(self, outputobj, logelm, lconvfrm):
return CONV_OK

try:
rscid, op = self.parse_opid(logelm.halogmsg.split()[5])[:2]
rscid, op = self.parse_opid(logelm.halogmsg.split()[4])[:2]
if op == "monitor":
return CONV_OK
except:
Expand Down Expand Up @@ -3064,8 +3064,8 @@ def detect_shutdown_request(self, outputobj, logelm, lconvfrm):
def fence_op_started(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
op = wordlist[2]
target = wordlist[7]
op = wordlist[1]
target = wordlist[6]
except:
return CONV_PARSE_ERROR
if self.is_empty(op, target):
Expand Down Expand Up @@ -3145,11 +3145,11 @@ def fence_too_many_failures(self, outputobj, logelm, lconvfrm):
def exec_st_device_started(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
by_node = wordlist[3]
op = wordlist[6]
for_node = wordlist[7]
if wordlist[8] == "with":
rsc = " " + wordlist[9]
by_node = self.trimmark(wordlist[2])
op = self.trimmark(wordlist[6])
for_node = self.trimmark(wordlist[5])
if wordlist[7] == "with":
rsc = " " + self.trimmark(wordlist[8])
else:
rsc = ""

Expand Down Expand Up @@ -3208,8 +3208,8 @@ def detect_attr_updated(self, outputobj, logelm, lconvfrm):
attrval = None
# attribute name can has empty char.
wordlist = logelm.halogmsg.split()
from_node = self.trimmark(wordlist[2].split("[")[1])
attrname = wordlist[2].split("[")[0]
from_node = self.trimmark(wordlist[1].split("[")[1])
attrname = wordlist[1].split("[")[0]
attrval = logelm.halogmsg.split("->")[1].split("from")[0].strip()
except:
return CONV_PARSE_ERROR
Expand All @@ -3233,8 +3233,8 @@ def detect_attr_updated(self, outputobj, logelm, lconvfrm):
def detect_attr_deleted(self, outputobj, logelm, lconvfrm):
try:
wordlist = logelm.halogmsg.split()
from_node = self.trimmark(wordlist[2].split("[")[1])
attrname = wordlist[2].split("[")[0]
from_node = self.trimmark(wordlist[1].split("[")[1])
attrname = wordlist[1].split("[")[0]
except:
return CONV_PARSE_ERROR
if self.is_empty(attrname):
Expand Down
2 changes: 1 addition & 1 deletion pm_logconv.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%define __check_files %{nil}
%define name pm_logconv
%define cluster cs
%define version 2.1
%define version 2.2
%define release 1
%define prefix /usr
%define instdir pm_logconv
Expand Down
Loading

0 comments on commit 22e30f7

Please sign in to comment.