• R/O
  • SSH

pm_logconv-cs: Commit

Pacemaker 対応ログメッセージ変換機能。

Heartbeat-2.1.4 用 hb-logconv(*) のPacemaker 1.0.x + Corosync スタック対応版。
(*) http://sourceforge.jp/projects/linux-ha/releases/?package_id=10282


Commit MetaInfo

Revisioncb7dd13446728a3b4fa1321ed473636542bb7513 (tree)
Time2013-05-23 11:05:19
AuthorYoshihiko SATO <satoyoshi@inte...>
CommiterYoshihiko SATO

Log Message

属性異常時のF/O判定処理を改修

Change Summary

Incremental Difference

diff -r 8558a6f44610 -r cb7dd1344672 pm_logconv.py
--- a/pm_logconv.py Wed May 22 17:53:38 2013 +0900
+++ b/pm_logconv.py Thu May 23 11:05:19 2013 +0900
@@ -104,11 +104,6 @@
104104 do_shutdown = False
105105
106106 #
107-# command name for getting current status of the cluster.
108-#
109-CMD_CRM_ATTR = "crm_attribute"
110-
111-#
112107 # command name for getting DC node status.
113108 #
114109 CMD_CRMADMIN = "crmadmin"
@@ -2020,37 +2015,8 @@
20202015 return None, None
20212016 # Get attribute value from log.
20222017 currentval = cstat.attrDict[node, attrname]
2023-
2024- if currentval == None:
2025- # Get attribute value from command.
2026- # Execute command.
2027- options = ("-G -U %s -t status -n %s" % (node, attrname))
2028- (status, output) = self.exec_outside_cmd(CMD_CRM_ATTR, options, False)
2029- if status == None:
2030- # Failed to exec command, or
2031- # The node is dead, or
2032- # Specified attribute doesn't exist.
2033- pm_log.warn("check_attribute(): " +
2034- "failed to get %s's value." % (attrname))
2035- return None, None
2036-
2037- pm_log.debug("check_attribute(): " +
2038- "%s's status[%s] output[%s] node[%s] attr[%s]" %
2039- (CMD_CRM_ATTR, status, output, node, attrname))
2040-
2041- if status != 0:
2042- # crm_attribute returns error value.
2043- # Maybe local node is shutting down.
2044- return None, None
2045- # In normal case, crm_attribute command shows like the following.
2046- # " name=default_ping_set value=100"
2047- # So parse it to get current attribute value.
2048- valuepos = output.index('value=')
2049- currentval = output[valuepos + len('value='):].strip()
2050- else:
2051- pm_log.debug("check_attribute(): " +
2052- "log's node[%s] attr[%s] value[%s]" %
2053- (node, attrname, currentval))
2018+ pm_log.debug("check_attribute(): log's node[%s] attr[%s] value[%s]" %
2019+ (node, attrname, currentval))
20542020
20552021 try:
20562022 if currentval.isdigit() and attrval.isdigit():
@@ -2093,34 +2059,7 @@
20932059 if (node, rule[0]) in cstat.attrDict:
20942060 # Get attribute value from log.
20952061 attrs[rule[0]] = cstat.attrDict[node, rule[0]]
2096-
2097- if attrs[rule[0]] == None:
2098- # Get attribute value from command.
2099- # Execute command.
2100- opts = ("-G -U %s -t status -n %s"%(node, rule[0]))
2101- (status, output) = self.exec_outside_cmd(CMD_CRM_ATTR, opts, False)
2102- if status == None:
2103- # Failed to exec command, or
2104- # The node is dead, or
2105- # Specified attribute doesn't exist.
2106- pm_log.warn("check_attributes(): "
2107- "failed to get %s's value."%(rule[0]))
2108- return None
2109- pm_log.debug("check_attributes(): "
2110- "%s's status[%s] output[%s] node[%s] attr[%s]"
2111- %(CMD_CRM_ATTR, status, output, node, rule[0]))
2112-
2113- if status != 0:
2114- # crm_attribute returns error value.
2115- # Maybe local node is shutting down.
2116- return None
2117- # In normal case, crm_attribute command shows like the following.
2118- # "name=default_ping_set value=100"
2119- # So parse it to get current attribute value.
2120- attrs[rule[0]] = output[output.index('value=')+len('value='):].strip()
2121- else:
2122- pm_log.debug("check_attribute(): " +
2123- "log's node[%s] attr[%s] value[%s]" %
2062+ pm_log.debug("check_attributes(): log's node[%s] attr[%s] value[%s]" %
21242063 (node, rule[0], attrs[rule[0]]))
21252064
21262065 if len(attrs) < 1:
@@ -2194,6 +2133,11 @@
21942133 False -> unmatched attribute not exists.
21952134 '''
21962135 def check_unmatch_attr_rule(self):
2136+ if \
2137+ (len(cstat.attrDict) == 0) or \
2138+ (len(attrRuleList) == 0 and len(attrRules) == 0):
2139+ return False
2140+
21972141 for node, stat in cstat.nodeDict.iteritems():
21982142 if stat != "online":
21992143 continue
@@ -3264,13 +3208,12 @@
32643208 try:
32653209 attrval=None
32663210 for word in logelm.halogmsg.split(", "):
3267- if word.startswith("id="):
3268- uuid_attrname = word.split("=")[1].split("-", 1)[1]
3211+ if word.startswith("node="):
3212+ nodename = word.split("=")[1]
32693213 elif word.startswith("name="):
32703214 attrname = word.split("=")[1]
32713215 elif word.startswith("value="):
32723216 attrval = word.split("=")[1]
3273- nodename = uuid_attrname.replace("-" + attrname, "")
32743217 except:
32753218 return CONV_PARSE_ERROR
32763219
Show on old repository browser