crm-fence-peer.9.sh: fix parsing in_ccm crmd fields of node_state with Pacemaker 2.1.7
PATCH 1/2 crm-fence-peer.9.sh: fix parsing in_ccm crmd fields of node_state with Pacemaker 2.1.7
From: Su Yue <[email protected]>
If pacemaker version < 2.1.7, in_ccm of node_state is "true" or "false" and crmd is "online" or "offline".
pacemaker 2.1.7 changed the two fields into timestamps.
For in_ccm, the value is timestamp since when node has been a cluster member("true"). A value 0 of means the node is not a cluster member("false"). For crmd, the value is timestamp since when peer has been online in CPG("online"). A value 0 means the peer is offline in CPG("offline").
The original code doesn't handle these fields in timestamp format. Since there are many comprare of strings in context, converting in_ccm and crmd from timestamps/0 to old strings is simpler and clearer.
--- scripts/crm-fence-peer.9.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
scripts/crm-fence-peer.9.sh +25 -0
@@ -888,6 +888,31 @@ guess_if_pacemaker_will_fence() esac done + # Copied from pacemaker-2.1.7:lib/pengine/unpack.c: + # Since crm_feature_set 3.18.0 (pacemaker-2.1.7): + # + # - in_ccm ::= <timestamp>|0 + # Since when node has been a cluster member. A value 0 of means the + # node is not a cluster member. + # - crmd ::= <timestamp>|0 + # Since when peer has been online in CPG. A value 0 means the peer + # is offline in CPG. + if [[ $in_ccm =~ ^[0-9]+$ ]]; then + if [[ $in_ccm = "0" ]]; then + in_ccm="false" + else + in_ccm="true" + fi + fi + + if [[ $crmd =~ ^[0-9]+$ ]]; then + if [[ $crmd = "0" ]]; then + crmd="offline" + else + crmd="online" + fi + fi + # if it is not enabled, no point in waiting for it. if ! $stonith_enabled ; then # "normalize" the rest of the logic
Signature · 1 line
2.44.0
PATCH 2/2 crm-fence-peer.9.sh: use join of node_state to judge whether node is banned
From: Su Yue <[email protected]>
crmd in node_state can't be "banned". join should be used instead of crmd.
--- scripts/crm-fence-peer.9.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/crm-fence-peer.9.sh +1 -1
@@ -934,7 +934,7 @@ guess_if_pacemaker_will_fence() # for further inspiration, see pacemaker:lib/pengine/unpack.c, determine_online_status_fencing() [[ -z $in_ccm ]] && will_fence=true - [[ $crmd = "banned" ]] && will_fence=true + [[ $join = "banned" ]] && will_fence=true if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then : "pacemaker considers this as clean down" elif [[ $in_ccm = false ]] || [[ $crmd != "online" ]]; then
Signature · 1 line
2.44.0
Re: [PATCH 2/2] crm-fence-peer.9.sh: use join of node_state to judge whether node is banned
Hi, dear drbd folks
Would you help review the patches for drbd-utils? Many thanks!
—
Su
Quoted 28 lines · Su Yue
From: Su Yue <[email protected]>
crmd in
node_statecan't be "banned". join should be used instead of crmd.Signed-off-by Su Yue <[email protected]>---
scripts/crm-fence-peer.9.sh| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)scripts/crm-fence-peer.9.sh +0
-0@@ -934,7 +934,7 @@ guess_if_pacemaker_will_fence() # for further inspiration, see pacemaker:lib/pengine/unpack.c, determine_online_status_fencing()[[ -z $in_ccm ]] && will_fence=true
- [[ $crmd = "banned" ]] && will_fence=true
+ [[ $join = "banned" ]] && will_fence=true
if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then : "pacemaker considers this as clean down"
elif [[ $in_ccm = false ]] || [[ $crmd != "online" ]]; thenSignature · 1 line
2.44.0
Re: [PATCH 2/2] crm-fence-peer.9.sh: use join of node_state to judge whether node is banned
Quoted 7 lines · Su Yue
Hi, dear drbd folks
Would you help review the patches for drbd-utils? Many thanks!
Gentle ping.
—
Su
Quoted 32 lines
—
SuQuoted 28 lines · Su Yue
From: Su Yue <[email protected]>
crmd in
node_statecan't be "banned". join should be used instead of crmd.Signed-off-by Su Yue <[email protected]>---
scripts/crm-fence-peer.9.sh| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)scripts/crm-fence-peer.9.sh +0
-0@@ -934,7 +934,7 @@ guess_if_pacemaker_will_fence() # for further inspiration, see pacemaker:lib/pengine/unpack.c, determine_online_status_fencing()[[ -z $in_ccm ]] && will_fence=true
- [[ $crmd = "banned" ]] && will_fence=true
+ [[ $join = "banned" ]] && will_fence=true
if [[ ${expected-down} = "down" && $in_ccm = "false" && $crmd != "online" ]]; then : "pacemaker considers this as clean down"
elif [[ $in_ccm = false ]] || [[ $crmd != "online" ]]; thenSignature · 1 line
2.44.0
Lars Ellenberg
maintainerRe: [PATCH 2/2] crm-fence-peer.9.sh: use join of node_state to judge whether node is banned
Quoted 8 lines · Su Yue
Quoted 7 lines · Su Yue
Hi, dear drbd folks
Would you help review the patches for drbd-utils? Many thanks!Gentle ping.
So you apparently have some kind of test suite
excercising this fencing handler?
Thank you for making us aware, and for your patience. Looks plausible.
Lars
Re: [PATCH 2/2] crm-fence-peer.9.sh: use join of node_state to judge whether node is banned
Quoted 9 lines · Lars Ellenberg
Quoted 4 lines · Su Yue
Quoted 4 lines · Su Yue
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Hi, dear drbd folks
Would you help review the patches for drbd-utils? Many thanks!Gentle ping.
So you apparently have some kind of test suite
excercising this fencing handler?
Yes. SUSE does have internal tests for drbd in HA environment. The issue of patch1 was exposed with pacemaker-2.1.7 in SLES-15SP6. Patch2 was filed during debug process of the above issue. It looks like a small mistake when the judgement was introduced.
And the patches survived in our test scenarios.
Thanks,
Su
Quoted 5 lines
Thank you for making us aware, and for your patience. Looks plausible.
Lars