From 0cd2c19d11f38f492214626a14bbfc2f1dcfb4ad Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Wed, 1 Apr 2020 12:23:29 +0200
Subject: [PATCH 10/15] Feature: scheduler: priority-fencing-delay defaults to
 0 meaning disabled

This commit also documents the upcoming new behavior as discussed from:

https://github.com/ClusterLabs/pacemaker/pull/2012

Any static/random delays that are introduced by `pcmk_delay_base/max`
configured for the corresponding fencing resources will be added to this
delay. This delay should be significantly greater than, safely twice,
the maximum `pcmk_delay_base/max`. By default, priority fencing delay is
disabled.
---
 doc/Pacemaker_Explained/en-US/Ch-Options.txt | 16 ++++++++--------
 include/crm/pengine/pe_types.h               |  2 +-
 lib/pengine/common.c                         | 18 +++++++++---------
 lib/pengine/unpack.c                         |  2 --
 4 files changed, 18 insertions(+), 20 deletions(-)

Index: pacemaker-2.0.1+20190417.13d370ca9/doc/Pacemaker_Explained/en-US/Ch-Options.txt
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/doc/Pacemaker_Explained/en-US/Ch-Options.txt
+++ pacemaker-2.0.1+20190417.13d370ca9/doc/Pacemaker_Explained/en-US/Ch-Options.txt
@@ -281,21 +281,21 @@ indexterm:[concurrent-fencing,Cluster Op
 indexterm:[Cluster,Option,concurrent-fencing]
 Is the cluster allowed to initiate multiple fence actions concurrently?
 
-| priority-fencing-delay  | |
+| priority-fencing-delay  | 0 |
 indexterm:[priority-fencing-delay,Cluster Option]
 indexterm:[Cluster,Option,priority-fencing-delay]
-Enforce specified delay for the fencings that are targeting the lost
+Apply specified delay for the fencings that are targeting the lost
 nodes with the highest total resource priority in case we don't
 have the majority of the nodes in our cluster partition, so that
 the more significant nodes potentially win any fencing match,
 which is especially meaningful under split-brain of 2-node
 cluster. A promoted resource instance takes the base priority + 1
-on calculation if the base priority is not 0. If all the nodes
-have equal priority, then any pcmk_delay_base/max configured for
-the corresponding fencing resources will be applied. Otherwise as
-long as it's set, even if to 0, it takes precedence over any
-configured pcmk_delay_base/max. By default, priority fencing
-delay is disabled.
+on calculation if the base priority is not 0. Any static/random
+delays that are introduced by `pcmk_delay_base/max` configured
+for the corresponding fencing resources will be added to this
+delay. This delay should be significantly greater than, safely
+twice, the maximum `pcmk_delay_base/max`. By default, priority
+fencing delay is disabled.
 
 | cluster-delay | 60s |
 indexterm:[cluster-delay,Cluster Option]
Index: pacemaker-2.0.1+20190417.13d370ca9/include/crm/pengine/pe_types.h
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/include/crm/pengine/pe_types.h
+++ pacemaker-2.0.1+20190417.13d370ca9/include/crm/pengine/pe_types.h
@@ -160,7 +160,7 @@ struct pe_working_set_s {
 
     GList *param_check; // History entries that need to be checked
     GList *stop_needed; // Containers that need stop actions
-    int priority_fencing_delay; // Enforced priority fencing delay
+    int priority_fencing_delay; // Priority fencing delay
 };
 
 enum pe_check_parameters {
Index: pacemaker-2.0.1+20190417.13d370ca9/lib/pengine/common.c
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/lib/pengine/common.c
+++ pacemaker-2.0.1+20190417.13d370ca9/lib/pengine/common.c
@@ -101,20 +101,20 @@ static pe_cluster_option pe_opts[] = {
 	  "STONITH unseen nodes", "Advanced Use Only!  Not using the default is very unsafe!" },
     {
         XML_CONFIG_ATTR_PRIORITY_FENCING_DELAY, NULL, "time", NULL,
-        NULL, &check_timer,
-        "Enforced fencing delay targeting the lost nodes with the highest total resource priority",
-        "Enforce specified delay for the fencings that are targeting the lost "
+        "0", &check_timer,
+        "Apply fencing delay targeting the lost nodes with the highest total resource priority",
+        "Apply specified delay for the fencings that are targeting the lost "
             "nodes with the highest total resource priority in case we don't "
             "have the majority of the nodes in our cluster partition, so that "
             "the more significant nodes potentially win any fencing match, "
             "which is especially meaningful under split-brain of 2-node "
             "cluster. A promoted resource instance takes the base priority + 1 "
-            "on calculation if the base priority is not 0. If all the nodes "
-            "have equal priority, then any pcmk_delay_base/max configured for "
-            "the corresponding fencing resources will be applied. Otherwise as "
-            "long as it's set, even if to 0, it takes precedence over any "
-            "configured pcmk_delay_base/max. By default, priority fencing "
-            "delay is disabled."
+            "on calculation if the base priority is not 0. Any static/random "
+            "delays that are introduced by `pcmk_delay_base/max` configured "
+            "for the corresponding fencing resources will be added to this "
+            "delay. This delay should be significantly greater than, safely "
+            "twice, the maximum `pcmk_delay_base/max`. By default, priority "
+            "fencing delay is disabled."
     },
 
 	/* Timeouts etc */
Index: pacemaker-2.0.1+20190417.13d370ca9/lib/pengine/unpack.c
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/lib/pengine/unpack.c
+++ pacemaker-2.0.1+20190417.13d370ca9/lib/pengine/unpack.c
@@ -218,8 +218,6 @@ unpack_config(xmlNode * config, pe_worki
     crm_debug("Concurrent fencing is %s",
               is_set(data_set->flags, pe_flag_concurrent_fencing) ? "enabled" : "disabled");
 
-    // Default value -1 means `priority-fencing-delay` is disabled
-    data_set->priority_fencing_delay = -1;
     value = pe_pref(data_set->config_hash,
                     XML_CONFIG_ATTR_PRIORITY_FENCING_DELAY);
     if (value) {
