Blame SOURCES/008-stonith_admin-header-refactoring.patch

4c8e44
From 756a3e522aa444b456e21128a52317226b346005 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Tue, 21 May 2019 15:26:20 -0500
4c8e44
Subject: [PATCH 01/11] Doc: libpacemaker: correct doxygen block for shutdown
4c8e44
 op creator
4c8e44
4c8e44
copy/paste error
4c8e44
---
4c8e44
 lib/pacemaker/pcmk_sched_utils.c | 5 +----
4c8e44
 1 file changed, 1 insertion(+), 4 deletions(-)
4c8e44
4c8e44
diff --git a/lib/pacemaker/pcmk_sched_utils.c b/lib/pacemaker/pcmk_sched_utils.c
4c8e44
index 5342e51..7b5cb7d 100644
4c8e44
--- a/lib/pacemaker/pcmk_sched_utils.c
4c8e44
+++ b/lib/pacemaker/pcmk_sched_utils.c
4c8e44
@@ -446,10 +446,7 @@ pe_cancel_op(pe_resource_t *rsc, const char *task, guint interval_ms,
4c8e44
  * \internal
4c8e44
  * \brief Create a shutdown op for a scheduler transition
4c8e44
  *
4c8e44
- * \param[in] rsc          Resource of action to cancel
4c8e44
- * \param[in] task         Name of action to cancel
4c8e44
- * \param[in] interval_ms  Interval of action to cancel
4c8e44
- * \param[in] node         Node of action to cancel
4c8e44
+ * \param[in] node         Node being shut down
4c8e44
  * \param[in] data_set     Working set of cluster
4c8e44
  *
4c8e44
  * \return Created op
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 5249dd9295307c0e22e223ea7d6f5f24a0a3fe25 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Fri, 24 May 2019 10:17:15 -0500
4c8e44
Subject: [PATCH 02/11] Refactor: libpe_status: rename target rc function
4c8e44
4c8e44
... in line with current naming standards, to avoid confusion with
4c8e44
controller function of the same name
4c8e44
---
4c8e44
 include/crm/pengine/internal.h | 2 +-
4c8e44
 lib/pengine/failcounts.c       | 4 ++--
4c8e44
 lib/pengine/unpack.c           | 4 ++--
4c8e44
 3 files changed, 5 insertions(+), 5 deletions(-)
4c8e44
4c8e44
diff --git a/include/crm/pengine/internal.h b/include/crm/pengine/internal.h
4c8e44
index 6d22db7..fd55bb9 100644
4c8e44
--- a/include/crm/pengine/internal.h
4c8e44
+++ b/include/crm/pengine/internal.h
4c8e44
@@ -288,7 +288,7 @@ pe_base_name_eq(resource_t *rsc, const char *id)
4c8e44
     return FALSE;
4c8e44
 }
4c8e44
 
4c8e44
-int get_target_rc(xmlNode * xml_op);
4c8e44
+int pe__target_rc_from_xml(xmlNode *xml_op);
4c8e44
 
4c8e44
 gint sort_node_uname(gconstpointer a, gconstpointer b);
4c8e44
 bool is_set_recursive(resource_t * rsc, long long flag, bool any);
4c8e44
diff --git a/lib/pengine/failcounts.c b/lib/pengine/failcounts.c
4c8e44
index 8f01c07..0c8ca5d 100644
4c8e44
--- a/lib/pengine/failcounts.c
4c8e44
+++ b/lib/pengine/failcounts.c
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 /*
4c8e44
- * Copyright 2008-2018 Andrew Beekhof <andrew@beekhof.net>
4c8e44
+ * Copyright 2008-2019 the Pacemaker project contributors
4c8e44
  *
4c8e44
  * This source code is licensed under the GNU Lesser General Public License
4c8e44
  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
@@ -62,7 +62,7 @@ is_matched_failure(const char *rsc_id, xmlNode *conf_op_xml,
4c8e44
 
4c8e44
         if (safe_str_eq(expected_op_key, lrm_op_id)) {
4c8e44
             int rc = 0;
4c8e44
-            int target_rc = get_target_rc(lrm_op_xml);
4c8e44
+            int target_rc = pe__target_rc_from_xml(lrm_op_xml);
4c8e44
 
4c8e44
             crm_element_value_int(lrm_op_xml, XML_LRM_ATTR_RC, &rc);
4c8e44
             if (rc != target_rc) {
4c8e44
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
4c8e44
index 02cef2c..0e8177b 100644
4c8e44
--- a/lib/pengine/unpack.c
4c8e44
+++ b/lib/pengine/unpack.c
4c8e44
@@ -3013,7 +3013,7 @@ static bool check_operation_expiry(resource_t *rsc, node_t *node, int rc, xmlNod
4c8e44
     return expired;
4c8e44
 }
4c8e44
 
4c8e44
-int get_target_rc(xmlNode *xml_op)
4c8e44
+int pe__target_rc_from_xml(xmlNode *xml_op)
4c8e44
 {
4c8e44
     int target_rc = 0;
4c8e44
     const char *key = crm_element_value(xml_op, XML_ATTR_TRANSITION_KEY);
4c8e44
@@ -3141,7 +3141,7 @@ unpack_rsc_op(resource_t * rsc, node_t * node, xmlNode * xml_op, xmlNode ** last
4c8e44
 
4c8e44
     int rc = 0;
4c8e44
     int status = PCMK_LRM_OP_UNKNOWN;
4c8e44
-    int target_rc = get_target_rc(xml_op);
4c8e44
+    int target_rc = pe__target_rc_from_xml(xml_op);
4c8e44
     guint interval_ms = 0;
4c8e44
 
4c8e44
     gboolean expired = FALSE;
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 2ccbefc2b623a2671f14824c6aea87c87fc338a0 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Fri, 24 May 2019 09:59:35 -0500
4c8e44
Subject: [PATCH 03/11] Refactor: libpacemaker: make transition.h internal
4c8e44
4c8e44
transition.h has always been installed even though it was purely internal.
4c8e44
Since libtransitioner is now merged into libpacemaker, move transition.h
4c8e44
to include/pcmki/pcmki_transition.h and make it internal.
4c8e44
4c8e44
Also, get rid of pcmki_sched_transition.h since it no longer contains
4c8e44
anything transition-related, and move its two function declarations to
4c8e44
pcmki_sched_utils.h.
4c8e44
---
4c8e44
 daemons/controld/controld_execd_state.c |   4 +-
4c8e44
 daemons/controld/controld_fencing.h     |   2 +-
4c8e44
 daemons/controld/controld_join_dc.c     |   4 +-
4c8e44
 daemons/controld/controld_transition.h  |   2 +-
4c8e44
 daemons/controld/controld_utils.h       |   7 +-
4c8e44
 include/crm/Makefile.am                 |   5 +-
4c8e44
 include/crm/transition.h                | 153 --------------------------------
4c8e44
 include/pacemaker-internal.h            |   2 +-
4c8e44
 include/pcmki/Makefile.am               |  12 +--
4c8e44
 include/pcmki/pcmki_sched_transition.h  |  22 -----
4c8e44
 include/pcmki/pcmki_sched_utils.h       |  16 ++++
4c8e44
 include/pcmki/pcmki_transition.h        | 143 +++++++++++++++++++++++++++++
4c8e44
 lib/pacemaker/pcmk_sched_transition.c   |   3 +-
4c8e44
 lib/pacemaker/pcmk_trans_graph.c        |  27 ++----
4c8e44
 lib/pacemaker/pcmk_trans_unpack.c       |  23 ++---
4c8e44
 lib/pacemaker/pcmk_trans_utils.c        |  27 ++----
4c8e44
 tools/crm_simulate.c                    |   1 -
4c8e44
 17 files changed, 201 insertions(+), 252 deletions(-)
4c8e44
 delete mode 100644 include/crm/transition.h
4c8e44
 delete mode 100644 include/pcmki/pcmki_sched_transition.h
4c8e44
 create mode 100644 include/pcmki/pcmki_transition.h
4c8e44
4c8e44
diff --git a/daemons/controld/controld_execd_state.c b/daemons/controld/controld_execd_state.c
4c8e44
index 8a1a7f3..4e9f096 100644
4c8e44
--- a/daemons/controld/controld_execd_state.c
4c8e44
+++ b/daemons/controld/controld_execd_state.c
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 /*
4c8e44
- * Copyright 2012-2018 David Vossel <davidvossel@gmail.com>
4c8e44
+ * Copyright 2012-2019 the Pacemaker project contributors
4c8e44
  *
4c8e44
  * This source code is licensed under the GNU General Public License version 2
4c8e44
  * or later (GPLv2+) WITHOUT ANY WARRANTY.
4c8e44
@@ -10,6 +10,7 @@
4c8e44
 #include <crm/msg_xml.h>
4c8e44
 #include <crm/common/iso8601.h>
4c8e44
 
4c8e44
+#include <pacemaker-internal.h>
4c8e44
 #include <pacemaker-controld.h>
4c8e44
 #include <controld_fsa.h>
4c8e44
 #include <controld_messages.h>
4c8e44
@@ -18,7 +19,6 @@
4c8e44
 #include <controld_alerts.h>
4c8e44
 #include <crm/pengine/rules.h>
4c8e44
 #include <crm/pengine/rules_internal.h>
4c8e44
-#include <crm/transition.h>
4c8e44
 #include <crm/lrmd_alerts_internal.h>
4c8e44
 
4c8e44
 GHashTable *lrm_state_table = NULL;
4c8e44
diff --git a/daemons/controld/controld_fencing.h b/daemons/controld/controld_fencing.h
4c8e44
index 3ef537f..8f7f19b 100644
4c8e44
--- a/daemons/controld/controld_fencing.h
4c8e44
+++ b/daemons/controld/controld_fencing.h
4c8e44
@@ -11,7 +11,7 @@
4c8e44
 #  define CONTROLD_FENCING__H
4c8e44
 
4c8e44
 #include <stdbool.h>                // bool
4c8e44
-#include <crm/transition.h>         // crm_graph_t, crm_action_t
4c8e44
+#include <pacemaker-internal.h>     // crm_graph_t, crm_action_t
4c8e44
 
4c8e44
 // stonith fail counts
4c8e44
 void st_fail_count_reset(const char * target);
4c8e44
diff --git a/daemons/controld/controld_join_dc.c b/daemons/controld/controld_join_dc.c
4c8e44
index ddee895..d790d9a 100644
4c8e44
--- a/daemons/controld/controld_join_dc.c
4c8e44
+++ b/daemons/controld/controld_join_dc.c
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 /*
4c8e44
- * Copyright 2004-2018 Andrew Beekhof <andrew@beekhof.net>
4c8e44
+ * Copyright 2004-2019 the Pacemaker project contributors
4c8e44
  *
4c8e44
  * This source code is licensed under the GNU General Public License version 2
4c8e44
  * or later (GPLv2+) WITHOUT ANY WARRANTY.
4c8e44
@@ -15,7 +15,7 @@
4c8e44
 
4c8e44
 #include <controld_fsa.h>
4c8e44
 #include <controld_messages.h>
4c8e44
-#include "controld_transition.h"
4c8e44
+#include <controld_transition.h>
4c8e44
 
4c8e44
 char *max_epoch = NULL;
4c8e44
 char *max_generation_from = NULL;
4c8e44
diff --git a/daemons/controld/controld_transition.h b/daemons/controld/controld_transition.h
4c8e44
index f31ac2d..192a9e8 100644
4c8e44
--- a/daemons/controld/controld_transition.h
4c8e44
+++ b/daemons/controld/controld_transition.h
4c8e44
@@ -8,10 +8,10 @@
4c8e44
 #ifndef TENGINE__H
4c8e44
 #  define TENGINE__H
4c8e44
 
4c8e44
-#  include <crm/transition.h>
4c8e44
 #  include <crm/common/mainloop.h>
4c8e44
 #  include <crm/stonith-ng.h>
4c8e44
 #  include <crm/services.h>
4c8e44
+#  include <pacemaker-internal.h>
4c8e44
 
4c8e44
 /* tengine */
4c8e44
 extern crm_action_t *match_down_event(const char *target);
4c8e44
diff --git a/daemons/controld/controld_utils.h b/daemons/controld/controld_utils.h
4c8e44
index 8b80e3c..1946a82 100644
4c8e44
--- a/daemons/controld/controld_utils.h
4c8e44
+++ b/daemons/controld/controld_utils.h
4c8e44
@@ -11,11 +11,10 @@
4c8e44
 #  define CRMD_UTILS__H
4c8e44
 
4c8e44
 #  include <crm/crm.h>
4c8e44
-#  include <crm/transition.h>
4c8e44
 #  include <crm/common/xml.h>
4c8e44
-#  include <crm/cib/internal.h> /* For CIB_OP_MODIFY */
4c8e44
-#  include "controld_fsa.h"     // For fsa_cib_conn
4c8e44
-#  include "controld_alerts.h"
4c8e44
+#  include <crm/cib/internal.h>     // CIB_OP_MODIFY
4c8e44
+#  include <controld_fsa.h>         // fsa_cib_conn
4c8e44
+#  include <controld_alerts.h>
4c8e44
 
4c8e44
 #  define FAKE_TE_ID	"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
4c8e44
 
4c8e44
diff --git a/include/crm/Makefile.am b/include/crm/Makefile.am
4c8e44
index 3f5f4bf..bc939eb 100644
4c8e44
--- a/include/crm/Makefile.am
4c8e44
+++ b/include/crm/Makefile.am
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 #
4c8e44
-# Copyright 2004-2018 the Pacemaker project contributors
4c8e44
+# Copyright 2004-2019 the Pacemaker project contributors
4c8e44
 #
4c8e44
 # The version control history for this file may have further details.
4c8e44
 #
4c8e44
@@ -22,7 +22,6 @@ MAINTAINERCLEANFILES	= Makefile.in
4c8e44
 headerdir=$(pkgincludedir)/crm
4c8e44
 
4c8e44
 header_HEADERS		= attrd.h cib.h cluster.h compatibility.h crm.h \
4c8e44
-			  lrmd.h msg_xml.h services.h stonith-ng.h \
4c8e44
-			  transition.h
4c8e44
+			  lrmd.h msg_xml.h services.h stonith-ng.h
4c8e44
 
4c8e44
 SUBDIRS                 = common pengine cib fencing cluster
4c8e44
diff --git a/include/crm/transition.h b/include/crm/transition.h
4c8e44
deleted file mode 100644
4c8e44
index 6e9a875..0000000
4c8e44
--- a/include/crm/transition.h
4c8e44
+++ /dev/null
4c8e44
@@ -1,153 +0,0 @@
4c8e44
-/* 
4c8e44
- * Copyright 2004-2018 the Pacemaker project contributors
4c8e44
- *
4c8e44
- * The version control history for this file may have further details.
4c8e44
- * 
4c8e44
- * This program is free software; you can redistribute it and/or
4c8e44
- * modify it under the terms of the GNU Lesser General Public
4c8e44
- * License as published by the Free Software Foundation; either
4c8e44
- * version 2 of the License, or (at your option) any later version.
4c8e44
- * 
4c8e44
- * This software is distributed in the hope that it will be useful,
4c8e44
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4c8e44
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c8e44
- * General Public License for more details.
4c8e44
- * 
4c8e44
- * You should have received a copy of the GNU Lesser General Public
4c8e44
- * License along with this library; if not, write to the Free Software
4c8e44
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4c8e44
- */
4c8e44
-#ifndef CRM_TRANSITION__H
4c8e44
-#  define CRM_TRANSITION__H
4c8e44
-
4c8e44
-#ifdef __cplusplus
4c8e44
-extern "C" {
4c8e44
-#endif
4c8e44
-
4c8e44
-#include <crm/crm.h>
4c8e44
-#include <crm/msg_xml.h>
4c8e44
-#include <crm/common/xml.h>
4c8e44
-
4c8e44
-typedef enum {
4c8e44
-    action_type_pseudo,
4c8e44
-    action_type_rsc,
4c8e44
-    action_type_crm
4c8e44
-} action_type_e;
4c8e44
-
4c8e44
-typedef struct te_timer_s crm_action_timer_t;
4c8e44
-typedef struct crm_graph_s crm_graph_t;
4c8e44
-
4c8e44
-typedef struct synapse_s {
4c8e44
-    int id;
4c8e44
-    int priority;
4c8e44
-
4c8e44
-    gboolean ready;
4c8e44
-    gboolean failed;
4c8e44
-    gboolean executed;
4c8e44
-    gboolean confirmed;
4c8e44
-
4c8e44
-    GListPtr actions;           /* crm_action_t* */
4c8e44
-    GListPtr inputs;            /* crm_action_t* */
4c8e44
-} synapse_t;
4c8e44
-
4c8e44
-typedef struct crm_action_s {
4c8e44
-    int id;
4c8e44
-    int timeout;
4c8e44
-    guint interval_ms;
4c8e44
-    GHashTable *params;
4c8e44
-    action_type_e type;
4c8e44
-
4c8e44
-    crm_action_timer_t *timer;
4c8e44
-    synapse_t *synapse;
4c8e44
-
4c8e44
-    gboolean sent_update;       /* sent to the CIB */
4c8e44
-    gboolean executed;          /* sent to the CRM */
4c8e44
-    gboolean confirmed;
4c8e44
-
4c8e44
-    gboolean failed;
4c8e44
-    gboolean can_fail;
4c8e44
-
4c8e44
-    xmlNode *xml;
4c8e44
-
4c8e44
-} crm_action_t;
4c8e44
-
4c8e44
-struct te_timer_s {
4c8e44
-    int source_id;
4c8e44
-    int timeout;
4c8e44
-    crm_action_t *action;
4c8e44
-};
4c8e44
-
4c8e44
-/* order matters here */
4c8e44
-enum transition_action {
4c8e44
-    tg_done,
4c8e44
-    tg_stop,
4c8e44
-    tg_restart,
4c8e44
-    tg_shutdown,
4c8e44
-};
4c8e44
-
4c8e44
-struct crm_graph_s {
4c8e44
-    int id;
4c8e44
-    char *source;
4c8e44
-    int abort_priority;
4c8e44
-
4c8e44
-    gboolean complete;
4c8e44
-    const char *abort_reason;
4c8e44
-    enum transition_action completion_action;
4c8e44
-
4c8e44
-    int num_actions;
4c8e44
-    int num_synapses;
4c8e44
-
4c8e44
-    int batch_limit;
4c8e44
-    int network_delay;
4c8e44
-    int stonith_timeout;
4c8e44
-    int transition_timeout;
4c8e44
-
4c8e44
-    int fired;
4c8e44
-    int pending;
4c8e44
-    int skipped;
4c8e44
-    int completed;
4c8e44
-    int incomplete;
4c8e44
-
4c8e44
-    GListPtr synapses;          /* synapse_t* */
4c8e44
-
4c8e44
-    int migration_limit;
4c8e44
-};
4c8e44
-
4c8e44
-typedef struct crm_graph_functions_s {
4c8e44
-    gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
4c8e44
-    gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
4c8e44
-    gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
4c8e44
-    gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
4c8e44
-    gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
4c8e44
-} crm_graph_functions_t;
4c8e44
-
4c8e44
-enum transition_status {
4c8e44
-    transition_active,
4c8e44
-    transition_pending,         /* active but no actions performed this time */
4c8e44
-    transition_complete,
4c8e44
-    transition_stopped,
4c8e44
-    transition_terminated,
4c8e44
-    transition_action_failed,
4c8e44
-    transition_failed,
4c8e44
-};
4c8e44
-
4c8e44
-void set_default_graph_functions(void);
4c8e44
-void set_graph_functions(crm_graph_functions_t * fns);
4c8e44
-crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference);
4c8e44
-int run_graph(crm_graph_t * graph);
4c8e44
-gboolean update_graph(crm_graph_t * graph, crm_action_t * action);
4c8e44
-void destroy_graph(crm_graph_t * graph);
4c8e44
-const char *transition_status(enum transition_status state);
4c8e44
-void print_graph(unsigned int log_level, crm_graph_t * graph);
4c8e44
-void print_action(int log_level, const char *prefix, crm_action_t * action);
4c8e44
-bool update_abort_priority(crm_graph_t * graph, int priority,
4c8e44
-                           enum transition_action action, const char *abort_reason);
4c8e44
-const char *actiontype2text(action_type_e type);
4c8e44
-lrmd_event_data_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status,
4c8e44
-                                        int rc);
4c8e44
-
4c8e44
-#ifdef __cplusplus
4c8e44
-}
4c8e44
-#endif
4c8e44
-
4c8e44
-#endif
4c8e44
diff --git a/include/pacemaker-internal.h b/include/pacemaker-internal.h
4c8e44
index 3627ba5..51d7225 100644
4c8e44
--- a/include/pacemaker-internal.h
4c8e44
+++ b/include/pacemaker-internal.h
4c8e44
@@ -13,8 +13,8 @@
4c8e44
 #  include <pcmki/pcmki_error.h>
4c8e44
 #  include <pcmki/pcmki_sched_allocate.h>
4c8e44
 #  include <pcmki/pcmki_sched_notif.h>
4c8e44
-#  include <pcmki/pcmki_sched_transition.h>
4c8e44
 #  include <pcmki/pcmki_sched_utils.h>
4c8e44
 #  include <pcmki/pcmki_scheduler.h>
4c8e44
+#  include <pcmki/pcmki_transition.h>
4c8e44
 
4c8e44
 #endif
4c8e44
diff --git a/include/pcmki/Makefile.am b/include/pcmki/Makefile.am
4c8e44
index b163e89..4cf1cf2 100644
4c8e44
--- a/include/pcmki/Makefile.am
4c8e44
+++ b/include/pcmki/Makefile.am
4c8e44
@@ -9,11 +9,11 @@
4c8e44
 
4c8e44
 MAINTAINERCLEANFILES    = Makefile.in
4c8e44
 
4c8e44
-noinst_HEADERS	        = pcmki_error.h \
4c8e44
-						  pcmki_sched_allocate.h \
4c8e44
-						  pcmki_sched_notif.h \
4c8e44
-						  pcmki_sched_transition.h \
4c8e44
-						  pcmki_sched_utils.h \
4c8e44
-						  pcmki_scheduler.h
4c8e44
+noinst_HEADERS		= pcmki_error.h \
4c8e44
+			  pcmki_sched_allocate.h \
4c8e44
+			  pcmki_sched_notif.h \
4c8e44
+			  pcmki_sched_utils.h \
4c8e44
+			  pcmki_scheduler.h \
4c8e44
+			  pcmki_transition.h
4c8e44
 
4c8e44
 .PHONY: $(ARCHIVE_VERSION)
4c8e44
diff --git a/include/pcmki/pcmki_sched_transition.h b/include/pcmki/pcmki_sched_transition.h
4c8e44
deleted file mode 100644
4c8e44
index 41f5d61..0000000
4c8e44
--- a/include/pcmki/pcmki_sched_transition.h
4c8e44
+++ /dev/null
4c8e44
@@ -1,22 +0,0 @@
4c8e44
-/*
4c8e44
- * Copyright 2014-2019 the Pacemaker project contributors
4c8e44
- *
4c8e44
- * The version control history for this file may have further details.
4c8e44
- *
4c8e44
- * This source code is licensed under the GNU Lesser General Public License
4c8e44
- * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
- */
4c8e44
-#ifndef SCHED_TRANSITION__H
4c8e44
-#  define SCHED_TRANSITION__H
4c8e44
-
4c8e44
-#include <crm/cib.h>
4c8e44
-
4c8e44
-void modify_configuration(
4c8e44
-    pe_working_set_t * data_set, cib_t *cib,
4c8e44
-    const char *quorum, const char *watchdog, GListPtr node_up, GListPtr node_down, GListPtr node_fail,
4c8e44
-    GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke,
4c8e44
-    GListPtr ticket_standby, GListPtr ticket_activate);
4c8e44
-
4c8e44
-int run_simulation(pe_working_set_t * data_set, cib_t *cib, GListPtr op_fail_list, bool quiet);
4c8e44
-
4c8e44
-#endif
4c8e44
diff --git a/include/pcmki/pcmki_sched_utils.h b/include/pcmki/pcmki_sched_utils.h
4c8e44
index b47a2bb..4361235 100644
4c8e44
--- a/include/pcmki/pcmki_sched_utils.h
4c8e44
+++ b/include/pcmki/pcmki_sched_utils.h
4c8e44
@@ -10,6 +10,14 @@
4c8e44
 #ifndef PENGINE_AUTILS__H
4c8e44
 #  define PENGINE_AUTILS__H
4c8e44
 
4c8e44
+#include <stdbool.h>                    // bool
4c8e44
+#include <glib.h>                       // GList, GHashTable, gboolean, guint
4c8e44
+#include <crm/crm.h>                    // GListPtr
4c8e44
+#include <crm/cib.h>                    // cib_t
4c8e44
+#include <crm/pengine/pe_types.h>
4c8e44
+#include <crm/pengine/internal.h>
4c8e44
+#include <pcmki/pcmki_scheduler.h>
4c8e44
+
4c8e44
 /* Constraint helper functions */
4c8e44
 extern rsc_colocation_t *invert_constraint(rsc_colocation_t * constraint);
4c8e44
 
4c8e44
@@ -75,4 +83,12 @@ pe_action_t *sched_shutdown_op(pe_node_t *node, pe_working_set_t *data_set);
4c8e44
 
4c8e44
 #  define LOAD_STOPPED "load_stopped"
4c8e44
 
4c8e44
+void modify_configuration(
4c8e44
+    pe_working_set_t * data_set, cib_t *cib,
4c8e44
+    const char *quorum, const char *watchdog, GListPtr node_up, GListPtr node_down, GListPtr node_fail,
4c8e44
+    GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke,
4c8e44
+    GListPtr ticket_standby, GListPtr ticket_activate);
4c8e44
+
4c8e44
+int run_simulation(pe_working_set_t * data_set, cib_t *cib, GListPtr op_fail_list, bool quiet);
4c8e44
+
4c8e44
 #endif
4c8e44
diff --git a/include/pcmki/pcmki_transition.h b/include/pcmki/pcmki_transition.h
4c8e44
new file mode 100644
4c8e44
index 0000000..d9a0ff6
4c8e44
--- /dev/null
4c8e44
+++ b/include/pcmki/pcmki_transition.h
4c8e44
@@ -0,0 +1,143 @@
4c8e44
+/*
4c8e44
+ * Copyright 2004-2019 the Pacemaker project contributors
4c8e44
+ *
4c8e44
+ * The version control history for this file may have further details.
4c8e44
+ *
4c8e44
+ * This source code is licensed under the GNU Lesser General Public License
4c8e44
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
+ */
4c8e44
+
4c8e44
+#ifndef CRM_TRANSITION__H
4c8e44
+#  define CRM_TRANSITION__H
4c8e44
+
4c8e44
+#ifdef __cplusplus
4c8e44
+extern "C" {
4c8e44
+#endif
4c8e44
+
4c8e44
+#include <crm/crm.h>
4c8e44
+#include <crm/msg_xml.h>
4c8e44
+#include <crm/common/xml.h>
4c8e44
+
4c8e44
+typedef enum {
4c8e44
+    action_type_pseudo,
4c8e44
+    action_type_rsc,
4c8e44
+    action_type_crm
4c8e44
+} action_type_e;
4c8e44
+
4c8e44
+typedef struct te_timer_s crm_action_timer_t;
4c8e44
+typedef struct crm_graph_s crm_graph_t;
4c8e44
+
4c8e44
+typedef struct synapse_s {
4c8e44
+    int id;
4c8e44
+    int priority;
4c8e44
+
4c8e44
+    gboolean ready;
4c8e44
+    gboolean failed;
4c8e44
+    gboolean executed;
4c8e44
+    gboolean confirmed;
4c8e44
+
4c8e44
+    GListPtr actions;           /* crm_action_t* */
4c8e44
+    GListPtr inputs;            /* crm_action_t* */
4c8e44
+} synapse_t;
4c8e44
+
4c8e44
+typedef struct crm_action_s {
4c8e44
+    int id;
4c8e44
+    int timeout;
4c8e44
+    guint interval_ms;
4c8e44
+    GHashTable *params;
4c8e44
+    action_type_e type;
4c8e44
+
4c8e44
+    crm_action_timer_t *timer;
4c8e44
+    synapse_t *synapse;
4c8e44
+
4c8e44
+    gboolean sent_update;       /* sent to the CIB */
4c8e44
+    gboolean executed;          /* sent to the CRM */
4c8e44
+    gboolean confirmed;
4c8e44
+
4c8e44
+    gboolean failed;
4c8e44
+    gboolean can_fail;
4c8e44
+
4c8e44
+    xmlNode *xml;
4c8e44
+
4c8e44
+} crm_action_t;
4c8e44
+
4c8e44
+struct te_timer_s {
4c8e44
+    int source_id;
4c8e44
+    int timeout;
4c8e44
+    crm_action_t *action;
4c8e44
+};
4c8e44
+
4c8e44
+/* order matters here */
4c8e44
+enum transition_action {
4c8e44
+    tg_done,
4c8e44
+    tg_stop,
4c8e44
+    tg_restart,
4c8e44
+    tg_shutdown,
4c8e44
+};
4c8e44
+
4c8e44
+struct crm_graph_s {
4c8e44
+    int id;
4c8e44
+    char *source;
4c8e44
+    int abort_priority;
4c8e44
+
4c8e44
+    gboolean complete;
4c8e44
+    const char *abort_reason;
4c8e44
+    enum transition_action completion_action;
4c8e44
+
4c8e44
+    int num_actions;
4c8e44
+    int num_synapses;
4c8e44
+
4c8e44
+    int batch_limit;
4c8e44
+    int network_delay;
4c8e44
+    int stonith_timeout;
4c8e44
+    int transition_timeout;
4c8e44
+
4c8e44
+    int fired;
4c8e44
+    int pending;
4c8e44
+    int skipped;
4c8e44
+    int completed;
4c8e44
+    int incomplete;
4c8e44
+
4c8e44
+    GListPtr synapses;          /* synapse_t* */
4c8e44
+
4c8e44
+    int migration_limit;
4c8e44
+};
4c8e44
+
4c8e44
+typedef struct crm_graph_functions_s {
4c8e44
+    gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
4c8e44
+    gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
4c8e44
+    gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
4c8e44
+    gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
4c8e44
+    gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
4c8e44
+} crm_graph_functions_t;
4c8e44
+
4c8e44
+enum transition_status {
4c8e44
+    transition_active,
4c8e44
+    transition_pending,         /* active but no actions performed this time */
4c8e44
+    transition_complete,
4c8e44
+    transition_stopped,
4c8e44
+    transition_terminated,
4c8e44
+    transition_action_failed,
4c8e44
+    transition_failed,
4c8e44
+};
4c8e44
+
4c8e44
+void set_default_graph_functions(void);
4c8e44
+void set_graph_functions(crm_graph_functions_t * fns);
4c8e44
+crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference);
4c8e44
+int run_graph(crm_graph_t * graph);
4c8e44
+gboolean update_graph(crm_graph_t * graph, crm_action_t * action);
4c8e44
+void destroy_graph(crm_graph_t * graph);
4c8e44
+const char *transition_status(enum transition_status state);
4c8e44
+void print_graph(unsigned int log_level, crm_graph_t * graph);
4c8e44
+void print_action(int log_level, const char *prefix, crm_action_t * action);
4c8e44
+bool update_abort_priority(crm_graph_t * graph, int priority,
4c8e44
+                           enum transition_action action, const char *abort_reason);
4c8e44
+const char *actiontype2text(action_type_e type);
4c8e44
+lrmd_event_data_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status,
4c8e44
+                                        int rc);
4c8e44
+
4c8e44
+#ifdef __cplusplus
4c8e44
+}
4c8e44
+#endif
4c8e44
+
4c8e44
+#endif
4c8e44
diff --git a/lib/pacemaker/pcmk_sched_transition.c b/lib/pacemaker/pcmk_sched_transition.c
4c8e44
index 0fa5709..8ab8d82 100644
4c8e44
--- a/lib/pacemaker/pcmk_sched_transition.c
4c8e44
+++ b/lib/pacemaker/pcmk_sched_transition.c
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 /*
4c8e44
- * Copyright 2009-2018 Andrew Beekhof <andrew@beekhof.net>
4c8e44
+ * Copyright 2009-2019 the Pacemaker project contributors
4c8e44
  *
4c8e44
  * This source code is licensed under the GNU General Public License version 2
4c8e44
  * or later (GPLv2+) WITHOUT ANY WARRANTY.
4c8e44
@@ -19,7 +19,6 @@
4c8e44
 #include <crm/crm.h>
4c8e44
 #include <crm/cib.h>
4c8e44
 #include <crm/common/util.h>
4c8e44
-#include <crm/transition.h>
4c8e44
 #include <crm/common/iso8601.h>
4c8e44
 #include <crm/pengine/status.h>
4c8e44
 #include <pacemaker-internal.h>
4c8e44
diff --git a/lib/pacemaker/pcmk_trans_graph.c b/lib/pacemaker/pcmk_trans_graph.c
4c8e44
index 71568dd..77980e5 100644
4c8e44
--- a/lib/pacemaker/pcmk_trans_graph.c
4c8e44
+++ b/lib/pacemaker/pcmk_trans_graph.c
4c8e44
@@ -1,19 +1,10 @@
4c8e44
-/* 
4c8e44
- * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
4c8e44
- * 
4c8e44
- * This library is free software; you can redistribute it and/or
4c8e44
- * modify it under the terms of the GNU Lesser General Public
4c8e44
- * License as published by the Free Software Foundation; either
4c8e44
- * version 2.1 of the License, or (at your option) any later version.
4c8e44
- * 
4c8e44
- * This library is distributed in the hope that it will be useful,
4c8e44
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4c8e44
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c8e44
- * Lesser General Public License for more details.
4c8e44
- * 
4c8e44
- * You should have received a copy of the GNU Lesser General Public
4c8e44
- * License along with this library; if not, write to the Free Software
4c8e44
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4c8e44
+/*
4c8e44
+ * Copyright 2004-2019 the Pacemaker project contributors
4c8e44
+ *
4c8e44
+ * The version control history for this file may have further details.
4c8e44
+ *
4c8e44
+ * This source code is licensed under the GNU Lesser General Public License
4c8e44
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
  */
4c8e44
 
4c8e44
 #include <crm_internal.h>
4c8e44
@@ -21,9 +12,7 @@
4c8e44
 #include <crm/crm.h>
4c8e44
 #include <crm/msg_xml.h>
4c8e44
 #include <crm/common/xml.h>
4c8e44
-#include <crm/transition.h>
4c8e44
-/* #include <sys/param.h> */
4c8e44
-/*  */
4c8e44
+#include <pacemaker-internal.h>
4c8e44
 
4c8e44
 crm_graph_functions_t *graph_fns = NULL;
4c8e44
 
4c8e44
diff --git a/lib/pacemaker/pcmk_trans_unpack.c b/lib/pacemaker/pcmk_trans_unpack.c
4c8e44
index 31e39cb..b8147a9 100644
4c8e44
--- a/lib/pacemaker/pcmk_trans_unpack.c
4c8e44
+++ b/lib/pacemaker/pcmk_trans_unpack.c
4c8e44
@@ -1,30 +1,21 @@
4c8e44
 /*
4c8e44
- * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
4c8e44
+ * Copyright 2004-2019 the Pacemaker project contributors
4c8e44
  *
4c8e44
- * This library is free software; you can redistribute it and/or
4c8e44
- * modify it under the terms of the GNU Lesser General Public
4c8e44
- * License as published by the Free Software Foundation; either
4c8e44
- * version 2.1 of the License, or (at your option) any later version.
4c8e44
+ * The version control history for this file may have further details.
4c8e44
  *
4c8e44
- * This library is distributed in the hope that it will be useful,
4c8e44
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4c8e44
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c8e44
- * Lesser General Public License for more details.
4c8e44
- *
4c8e44
- * You should have received a copy of the GNU Lesser General Public
4c8e44
- * License along with this library; if not, write to the Free Software
4c8e44
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4c8e44
+ * This source code is licensed under the GNU Lesser General Public License
4c8e44
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
  */
4c8e44
 
4c8e44
 #include <crm_internal.h>
4c8e44
 
4c8e44
 #include <sys/param.h>
4c8e44
+#include <sys/stat.h>
4c8e44
+
4c8e44
 #include <crm/crm.h>
4c8e44
 #include <crm/msg_xml.h>
4c8e44
-
4c8e44
 #include <crm/common/xml.h>
4c8e44
-#include <crm/transition.h>
4c8e44
-#include <sys/stat.h>
4c8e44
+#include <pacemaker-internal.h>
4c8e44
 
4c8e44
 CRM_TRACE_INIT_DATA(transitioner);
4c8e44
 
4c8e44
diff --git a/lib/pacemaker/pcmk_trans_utils.c b/lib/pacemaker/pcmk_trans_utils.c
4c8e44
index d3199d9..69da7f4 100644
4c8e44
--- a/lib/pacemaker/pcmk_trans_utils.c
4c8e44
+++ b/lib/pacemaker/pcmk_trans_utils.c
4c8e44
@@ -1,19 +1,10 @@
4c8e44
-/* 
4c8e44
- * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
4c8e44
- * 
4c8e44
- * This library is free software; you can redistribute it and/or
4c8e44
- * modify it under the terms of the GNU Lesser General Public
4c8e44
- * License as published by the Free Software Foundation; either
4c8e44
- * version 2.1 of the License, or (at your option) any later version.
4c8e44
- * 
4c8e44
- * This library is distributed in the hope that it will be useful,
4c8e44
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4c8e44
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c8e44
- * Lesser General Public License for more details.
4c8e44
- * 
4c8e44
- * You should have received a copy of the GNU Lesser General Public
4c8e44
- * License along with this library; if not, write to the Free Software
4c8e44
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4c8e44
+/*
4c8e44
+ * Copyright 2004-2019 the Pacemaker project contributors
4c8e44
+ *
4c8e44
+ * The version control history for this file may have further details.
4c8e44
+ *
4c8e44
+ * This source code is licensed under the GNU Lesser General Public License
4c8e44
+ * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
4c8e44
  */
4c8e44
 
4c8e44
 #include <crm_internal.h>
4c8e44
@@ -21,9 +12,7 @@
4c8e44
 #include <crm/crm.h>
4c8e44
 #include <crm/msg_xml.h>
4c8e44
 #include <crm/common/xml.h>
4c8e44
-#include <crm/transition.h>
4c8e44
-/* #include <sys/param.h> */
4c8e44
-/*  */
4c8e44
+#include <pacemaker-internal.h>
4c8e44
 
4c8e44
 extern crm_graph_functions_t *graph_fns;
4c8e44
 
4c8e44
diff --git a/tools/crm_simulate.c b/tools/crm_simulate.c
4c8e44
index 1921ee4..d4ab6a3 100644
4c8e44
--- a/tools/crm_simulate.c
4c8e44
+++ b/tools/crm_simulate.c
4c8e44
@@ -21,7 +21,6 @@
4c8e44
 #include <crm/crm.h>
4c8e44
 #include <crm/cib.h>
4c8e44
 #include <crm/common/util.h>
4c8e44
-#include <crm/transition.h>
4c8e44
 #include <crm/common/iso8601.h>
4c8e44
 #include <crm/pengine/status.h>
4c8e44
 #include <pacemaker-internal.h>
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 8a0b29d8ed21c97075b4c059fa4b0f5c0d985a73 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Thu, 6 Jun 2019 14:18:37 -0500
4c8e44
Subject: [PATCH 04/11] Test: scheduler: explicitly set concurrent-fencing in
4c8e44
 relevant regression tests
4c8e44
4c8e44
... since concurrent-fencing's default is likely to eventually change,
4c8e44
which would otherwise affect the results of these tests
4c8e44
---
4c8e44
 cts/scheduler/rec-node-14.xml                     | 1 +
4c8e44
 cts/scheduler/remote-connection-unrecoverable.xml | 1 +
4c8e44
 cts/scheduler/remote-recover-all.xml              | 1 +
4c8e44
 cts/scheduler/remote-recover-no-resources.xml     | 1 +
4c8e44
 cts/scheduler/remote-recover-unknown.xml          | 1 +
4c8e44
 cts/scheduler/stonith-4.xml                       | 1 +
4c8e44
 cts/scheduler/suicide-needed-inquorate.xml        | 1 +
4c8e44
 cts/scheduler/ticket-clone-21.xml                 | 1 +
4c8e44
 cts/scheduler/ticket-clone-9.xml                  | 1 +
4c8e44
 9 files changed, 9 insertions(+)
4c8e44
4c8e44
diff --git a/cts/scheduler/rec-node-14.xml b/cts/scheduler/rec-node-14.xml
4c8e44
index 60307ba..aefa410 100644
4c8e44
--- a/cts/scheduler/rec-node-14.xml
4c8e44
+++ b/cts/scheduler/rec-node-14.xml
4c8e44
@@ -4,6 +4,7 @@
4c8e44
       <cluster_property_set id="cib-bootstrap-options">
4c8e44
         <nvpair id="nvpair.id21835" name="stonith-enabled" value="true"/>
4c8e44
         <nvpair id="nvpair.id21844" name="no-quorum-policy" value="ignore"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
diff --git a/cts/scheduler/remote-connection-unrecoverable.xml b/cts/scheduler/remote-connection-unrecoverable.xml
4c8e44
index df9fee2..efec646 100644
4c8e44
--- a/cts/scheduler/remote-connection-unrecoverable.xml
4c8e44
+++ b/cts/scheduler/remote-connection-unrecoverable.xml
4c8e44
@@ -7,6 +7,7 @@
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="mycluster"/>
4c8e44
         <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1459735110"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
diff --git a/cts/scheduler/remote-recover-all.xml b/cts/scheduler/remote-recover-all.xml
4c8e44
index 0ade7cd..1680166 100644
4c8e44
--- a/cts/scheduler/remote-recover-all.xml
4c8e44
+++ b/cts/scheduler/remote-recover-all.xml
4c8e44
@@ -10,6 +10,7 @@
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-recheck-interval" name="cluster-recheck-interval" value="60s"/>
4c8e44
         <nvpair id="cib-bootstrap-options-maintenance-mode" name="maintenance-mode" value="false"/>
4c8e44
         <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1493817755"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
       <cluster_property_set id="redis_replication">
4c8e44
         <nvpair id="redis_replication-redis_REPL_INFO" name="redis_REPL_INFO" value="controller-0"/>
4c8e44
diff --git a/cts/scheduler/remote-recover-no-resources.xml b/cts/scheduler/remote-recover-no-resources.xml
4c8e44
index 37708bb..602ed2b 100644
4c8e44
--- a/cts/scheduler/remote-recover-no-resources.xml
4c8e44
+++ b/cts/scheduler/remote-recover-no-resources.xml
4c8e44
@@ -10,6 +10,7 @@
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-recheck-interval" name="cluster-recheck-interval" value="60s"/>
4c8e44
         <nvpair id="cib-bootstrap-options-maintenance-mode" name="maintenance-mode" value="false"/>
4c8e44
         <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1493817755"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
       <cluster_property_set id="redis_replication">
4c8e44
         <nvpair id="redis_replication-redis_REPL_INFO" name="redis_REPL_INFO" value="controller-0"/>
4c8e44
diff --git a/cts/scheduler/remote-recover-unknown.xml b/cts/scheduler/remote-recover-unknown.xml
4c8e44
index f070f11..f47a841 100644
4c8e44
--- a/cts/scheduler/remote-recover-unknown.xml
4c8e44
+++ b/cts/scheduler/remote-recover-unknown.xml
4c8e44
@@ -10,6 +10,7 @@
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-recheck-interval" name="cluster-recheck-interval" value="60s"/>
4c8e44
         <nvpair id="cib-bootstrap-options-maintenance-mode" name="maintenance-mode" value="false"/>
4c8e44
         <nvpair id="cib-bootstrap-options-last-lrm-refresh" name="last-lrm-refresh" value="1493817755"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
       <cluster_property_set id="redis_replication">
4c8e44
         <nvpair id="redis_replication-redis_REPL_INFO" name="redis_REPL_INFO" value="controller-0"/>
4c8e44
diff --git a/cts/scheduler/stonith-4.xml b/cts/scheduler/stonith-4.xml
4c8e44
index 7979462..dd7af8d 100644
4c8e44
--- a/cts/scheduler/stonith-4.xml
4c8e44
+++ b/cts/scheduler/stonith-4.xml
4c8e44
@@ -4,6 +4,7 @@
4c8e44
       <cluster_property_set id="cib-bootstrap-options">
4c8e44
         <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.8-0.772.26fe3e5.git.fc17-26fe3e52d259e4726699300d27991fc1a80c556b"/>
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
diff --git a/cts/scheduler/suicide-needed-inquorate.xml b/cts/scheduler/suicide-needed-inquorate.xml
4c8e44
index e626ea6..f87422b 100644
4c8e44
--- a/cts/scheduler/suicide-needed-inquorate.xml
4c8e44
+++ b/cts/scheduler/suicide-needed-inquorate.xml
4c8e44
@@ -6,6 +6,7 @@
4c8e44
         <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.17-1"/>
4c8e44
         <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
4c8e44
         <nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="suicide"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
diff --git a/cts/scheduler/ticket-clone-21.xml b/cts/scheduler/ticket-clone-21.xml
4c8e44
index bb1f044..efd5294 100644
4c8e44
--- a/cts/scheduler/ticket-clone-21.xml
4c8e44
+++ b/cts/scheduler/ticket-clone-21.xml
4c8e44
@@ -4,6 +4,7 @@
4c8e44
       <cluster_property_set id="cib-bootstrap-options">
4c8e44
         <nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="true"/>
4c8e44
         <nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="ignore"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
diff --git a/cts/scheduler/ticket-clone-9.xml b/cts/scheduler/ticket-clone-9.xml
4c8e44
index e77210d..c6d5809 100644
4c8e44
--- a/cts/scheduler/ticket-clone-9.xml
4c8e44
+++ b/cts/scheduler/ticket-clone-9.xml
4c8e44
@@ -4,6 +4,7 @@
4c8e44
       <cluster_property_set id="cib-bootstrap-options">
4c8e44
         <nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="true"/>
4c8e44
         <nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="ignore"/>
4c8e44
+        <nvpair id="options-concurrent-fencing" name="concurrent-fencing" value="false"/>
4c8e44
       </cluster_property_set>
4c8e44
     </crm_config>
4c8e44
     <nodes>
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 359f0e6089ef618361acc2437d779ecad1edb8d3 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Thu, 6 Jun 2019 11:22:58 -0500
4c8e44
Subject: [PATCH 05/11] Build: doc: define variable properly
4c8e44
4c8e44
broke when moved from GNUmakefile to Makefile.am
4c8e44
---
4c8e44
 doc/Makefile.am | 6 +++---
4c8e44
 1 file changed, 3 insertions(+), 3 deletions(-)
4c8e44
4c8e44
diff --git a/doc/Makefile.am b/doc/Makefile.am
4c8e44
index f3b79bb..18747cf 100644
4c8e44
--- a/doc/Makefile.am
4c8e44
+++ b/doc/Makefile.am
4c8e44
@@ -25,6 +25,9 @@ RSYNC_DEST      ?= root@www.clusterlabs.org:/var/www/html
4c8e44
 # don't cross filesystems, sparse, show progress
4c8e44
 RSYNC_OPTS      = -rlptvzxS --progress
4c8e44
 
4c8e44
+LAST_RELEASE	?= Pacemaker-$(VERSION)
4c8e44
+TAG		?= $(shell git log --pretty=format:%H -n 1 HEAD)
4c8e44
+
4c8e44
 publican_docs   =
4c8e44
 generated_docs	=
4c8e44
 generated_mans	=
4c8e44
@@ -364,9 +367,6 @@ doxygen-upload: doxygen
4c8e44
 
4c8e44
 # ABI compatibility report as HTML
4c8e44
 
4c8e44
-LAST_RELEASE	?= Pacemaker-$(VERSION)
4c8e44
-TAG		?= $(git log --pretty=format:%H -n 1 HEAD)
4c8e44
-
4c8e44
 abi: abi-check
4c8e44
 	./abi-check $(PACKAGE) $(LAST_RELEASE) $(TAG)
4c8e44
 
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From c0e1ff4cc8578b78b085b98effff11747f81a397 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Mon, 10 Jun 2019 11:38:51 -0500
4c8e44
Subject: [PATCH 06/11] Doc: doxygen: avoid full paths in output graphics
4c8e44
4c8e44
broke when doxygen target moved from toplevel to doc subdirectory
4c8e44
---
4c8e44
 doc/Doxyfile.in | 4 ++--
4c8e44
 1 file changed, 2 insertions(+), 2 deletions(-)
4c8e44
4c8e44
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
4c8e44
index 81615fb..bc449df 100644
4c8e44
--- a/doc/Doxyfile.in
4c8e44
+++ b/doc/Doxyfile.in
4c8e44
@@ -142,7 +142,7 @@ FULL_PATH_NAMES        = YES
4c8e44
 # will be relative from the directory where doxygen is started.
4c8e44
 # This tag requires that the tag FULL_PATH_NAMES is set to YES.
4c8e44
 
4c8e44
-STRIP_FROM_PATH        =
4c8e44
+STRIP_FROM_PATH        = ..
4c8e44
 
4c8e44
 # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
4c8e44
 # path mentioned in the documentation of a class, which tells the reader which
4c8e44
@@ -151,7 +151,7 @@ STRIP_FROM_PATH        =
4c8e44
 # specify the list of include paths that are normally passed to the compiler
4c8e44
 # using the -I flag.
4c8e44
 
4c8e44
-STRIP_FROM_INC_PATH    =
4c8e44
+STRIP_FROM_INC_PATH    = ..
4c8e44
 
4c8e44
 # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
4c8e44
 # less readable) file names. This can be useful is your file systems doesn't
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From a0ab603c5c416148132a91f5bf22d55e65f8ba4e Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Tue, 11 Jun 2019 14:26:28 -0500
4c8e44
Subject: [PATCH 07/11] Low: xml: add API schema for list_item() output
4c8e44
4c8e44
---
4c8e44
 xml/Makefile.am      |  9 +++++----
4c8e44
 xml/api/item-1.1.rng | 19 +++++++++++++++++++
4c8e44
 2 files changed, 24 insertions(+), 4 deletions(-)
4c8e44
 create mode 100644 xml/api/item-1.1.rng
4c8e44
4c8e44
diff --git a/xml/Makefile.am b/xml/Makefile.am
4c8e44
index 88edbda..49542a3 100644
4c8e44
--- a/xml/Makefile.am
4c8e44
+++ b/xml/Makefile.am
4c8e44
@@ -1,5 +1,5 @@
4c8e44
 #
4c8e44
-# Copyright 2004-2018 the Pacemaker project contributors
4c8e44
+# Copyright 2004-2019 the Pacemaker project contributors
4c8e44
 #
4c8e44
 # The version control history for this file may have further details.
4c8e44
 #
4c8e44
@@ -63,8 +63,9 @@ RNG_max			?= $(lastword $(RNG_numeric_versions))
4c8e44
 
4c8e44
 # A sorted list of all API and RNG versions (numeric and "next")
4c8e44
 API_versions 		= next $(API_numeric_versions)
4c8e44
-API_base 			= command-output stonith_admin
4c8e44
-API_files 			= $(foreach base,$(API_base),$(wildcard api/$(base)*.rng))
4c8e44
+API_request_base 	= command-output stonith_admin
4c8e44
+API_base		= $(API_request_base) item
4c8e44
+API_files 		= $(foreach base,$(API_base),$(wildcard api/$(base)*.rng))
4c8e44
 
4c8e44
 RNG_versions		= next $(RNG_numeric_versions)
4c8e44
 RNG_version_pairs	= $(call version_pairs,${RNG_numeric_versions})
4c8e44
@@ -139,7 +140,7 @@ api/api-result-%.rng: $(API_files) Makefile.am
4c8e44
 	echo '      <attribute name="request"> <text /> </attribute>' >> $@
4c8e44
 	echo '      <optional>' >> $@
4c8e44
 	echo '        <choice>' >> $@
4c8e44
-	for rng in $(API_base); do $(top_srcdir)/xml/best-match.sh api/$$rng $(*) $(@) "          " || :; done
4c8e44
+	for rng in $(API_request_base); do $(top_srcdir)/xml/best-match.sh api/$$rng $(*) $(@) "          " || :; done
4c8e44
 	echo '        </choice>' >> $@
4c8e44
 	echo '      </optional>' >> $@
4c8e44
 	echo '      <element name="status">' >> $@
4c8e44
diff --git a/xml/api/item-1.1.rng b/xml/api/item-1.1.rng
4c8e44
new file mode 100644
4c8e44
index 0000000..1a065ca
4c8e44
--- /dev/null
4c8e44
+++ b/xml/api/item-1.1.rng
4c8e44
@@ -0,0 +1,19 @@
4c8e44
+
4c8e44
+
4c8e44
+         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
4c8e44
+
4c8e44
+    
4c8e44
+    <start>
4c8e44
+        <ref name="element-item"/>
4c8e44
+    </start>
4c8e44
+
4c8e44
+    <define name="element-item">
4c8e44
+        <element name="item">
4c8e44
+            <optional>
4c8e44
+                <attribute name="name"> <text /> </attribute>
4c8e44
+            </optional>
4c8e44
+            <data type="string"/>
4c8e44
+        </element>
4c8e44
+    </define>
4c8e44
+
4c8e44
+</grammar>
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 311d8629241d227dded598225d8f413c9ebb4a9b Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Tue, 11 Jun 2019 18:47:10 -0500
4c8e44
Subject: [PATCH 08/11] Refactor: fencing: expose function for parsing targets
4c8e44
 from string
4c8e44
4c8e44
... as internal API, so it can be reused elsewhere. Also, refactor it for
4c8e44
simplicity and versatility.
4c8e44
---
4c8e44
 daemons/fenced/fenced_commands.c |  91 +---------------------------
4c8e44
 include/crm/fencing/internal.h   |   3 +
4c8e44
 lib/fencing/st_client.c          | 128 +++++++++++++++++++++++++++++++++++++++
4c8e44
 3 files changed, 133 insertions(+), 89 deletions(-)
4c8e44
4c8e44
diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c
4c8e44
index 1be2508..54575f9 100644
4c8e44
--- a/daemons/fenced/fenced_commands.c
4c8e44
+++ b/daemons/fenced/fenced_commands.c
4c8e44
@@ -617,93 +617,6 @@ build_port_aliases(const char *hostmap, GListPtr * targets)
4c8e44
     return aliases;
4c8e44
 }
4c8e44
 
4c8e44
-static void
4c8e44
-parse_host_line(const char *line, int max, GListPtr * output)
4c8e44
-{
4c8e44
-    int lpc = 0;
4c8e44
-    int last = 0;
4c8e44
-
4c8e44
-    if (max <= 0) {
4c8e44
-        return;
4c8e44
-    }
4c8e44
-
4c8e44
-    /* Check for any complaints about additional parameters that the device doesn't understand */
4c8e44
-    if (strstr(line, "invalid") || strstr(line, "variable")) {
4c8e44
-        crm_debug("Skipping: %s", line);
4c8e44
-        return;
4c8e44
-    }
4c8e44
-
4c8e44
-    crm_trace("Processing %d bytes: [%s]", max, line);
4c8e44
-    /* Skip initial whitespace */
4c8e44
-    for (lpc = 0; lpc <= max && isspace(line[lpc]); lpc++) {
4c8e44
-        last = lpc + 1;
4c8e44
-    }
4c8e44
-
4c8e44
-    /* Now the actual content */
4c8e44
-    for (lpc = 0; lpc <= max; lpc++) {
4c8e44
-        gboolean a_space = isspace(line[lpc]);
4c8e44
-
4c8e44
-        if (a_space && lpc < max && isspace(line[lpc + 1])) {
4c8e44
-            /* fast-forward to the end of the spaces */
4c8e44
-
4c8e44
-        } else if (a_space || line[lpc] == ',' || line[lpc] == ';' || line[lpc] == 0) {
4c8e44
-            int rc = 1;
4c8e44
-            char *entry = NULL;
4c8e44
-
4c8e44
-            if (lpc != last) {
4c8e44
-                entry = calloc(1, 1 + lpc - last);
4c8e44
-                rc = sscanf(line + last, "%[a-zA-Z0-9_-.]", entry);
4c8e44
-            }
4c8e44
-
4c8e44
-            if (entry == NULL) {
4c8e44
-                /* Skip */
4c8e44
-            } else if (rc != 1) {
4c8e44
-                crm_warn("Could not parse (%d %d): %s", last, lpc, line + last);
4c8e44
-            } else if (safe_str_neq(entry, "on") && safe_str_neq(entry, "off")) {
4c8e44
-                crm_trace("Adding '%s'", entry);
4c8e44
-                *output = g_list_append(*output, entry);
4c8e44
-                entry = NULL;
4c8e44
-            }
4c8e44
-
4c8e44
-            free(entry);
4c8e44
-            last = lpc + 1;
4c8e44
-        }
4c8e44
-    }
4c8e44
-}
4c8e44
-
4c8e44
-static GListPtr
4c8e44
-parse_host_list(const char *hosts)
4c8e44
-{
4c8e44
-    int lpc = 0;
4c8e44
-    int max = 0;
4c8e44
-    int last = 0;
4c8e44
-    GListPtr output = NULL;
4c8e44
-
4c8e44
-    if (hosts == NULL) {
4c8e44
-        return output;
4c8e44
-    }
4c8e44
-
4c8e44
-    max = strlen(hosts);
4c8e44
-    for (lpc = 0; lpc <= max; lpc++) {
4c8e44
-        if (hosts[lpc] == '\n' || hosts[lpc] == 0) {
4c8e44
-            int len = lpc - last;
4c8e44
-
4c8e44
-            if(len > 1) {
4c8e44
-                char *line = strndup(hosts + last, len);
4c8e44
-
4c8e44
-                line[len] = 0; /* Because it might be '\n' */
4c8e44
-                parse_host_line(line, len, &output);
4c8e44
-                free(line);
4c8e44
-            }
4c8e44
-
4c8e44
-            last = lpc + 1;
4c8e44
-        }
4c8e44
-    }
4c8e44
-
4c8e44
-    crm_trace("Parsed %d entries from '%s'", g_list_length(output), hosts);
4c8e44
-    return output;
4c8e44
-}
4c8e44
-
4c8e44
 GHashTable *metadata_cache = NULL;
4c8e44
 
4c8e44
 void
4c8e44
@@ -937,7 +850,7 @@ build_device_from_xml(xmlNode * msg)
4c8e44
 
4c8e44
     value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTLIST);
4c8e44
     if (value) {
4c8e44
-        device->targets = parse_host_list(value);
4c8e44
+        device->targets = stonith__parse_targets(value);
4c8e44
     }
4c8e44
 
4c8e44
     value = g_hash_table_lookup(device->params, STONITH_ATTR_HOSTMAP);
4c8e44
@@ -1108,7 +1021,7 @@ dynamic_list_search_cb(GPid pid, int rc, const char *output, gpointer user_data)
4c8e44
     } else if (!rc) {
4c8e44
         crm_info("Refreshing port list for %s", dev->id);
4c8e44
         g_list_free_full(dev->targets, free);
4c8e44
-        dev->targets = parse_host_list(output);
4c8e44
+        dev->targets = stonith__parse_targets(output);
4c8e44
         dev->targets_age = time(NULL);
4c8e44
     }
4c8e44
 
4c8e44
diff --git a/include/crm/fencing/internal.h b/include/crm/fencing/internal.h
4c8e44
index 0c0ac70..f3d38a7 100644
4c8e44
--- a/include/crm/fencing/internal.h
4c8e44
+++ b/include/crm/fencing/internal.h
4c8e44
@@ -10,6 +10,7 @@
4c8e44
 #ifndef STONITH_NG_INTERNAL__H
4c8e44
 #  define STONITH_NG_INTERNAL__H
4c8e44
 
4c8e44
+#  include <glib.h>
4c8e44
 #  include <crm/common/ipc.h>
4c8e44
 #  include <crm/common/output.h>
4c8e44
 #  include <crm/common/xml.h>
4c8e44
@@ -49,6 +50,8 @@ xmlNode *create_device_registration_xml(const char *id,
4c8e44
 
4c8e44
 void stonith__register_messages(pcmk__output_t *out);
4c8e44
 
4c8e44
+GList *stonith__parse_targets(const char *hosts);
4c8e44
+
4c8e44
 #  define ST_LEVEL_MAX 10
4c8e44
 
4c8e44
 #  define F_STONITH_CLIENTID      "st_clientid"
4c8e44
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
4c8e44
index d949fe1..629887a 100644
4c8e44
--- a/lib/fencing/st_client.c
4c8e44
+++ b/lib/fencing/st_client.c
4c8e44
@@ -9,6 +9,7 @@
4c8e44
 #include <unistd.h>
4c8e44
 #include <stdlib.h>
4c8e44
 #include <stdio.h>
4c8e44
+#include <stdbool.h>
4c8e44
 #include <string.h>
4c8e44
 #include <ctype.h>
4c8e44
 #include <libgen.h>
4c8e44
@@ -2304,3 +2305,130 @@ stonith_action_str(const char *action)
4c8e44
         return action;
4c8e44
     }
4c8e44
 }
4c8e44
+
4c8e44
+/*!
4c8e44
+ * \internal
4c8e44
+ * \brief Parse a target name from one line of a target list string
4c8e44
+ *
4c8e44
+ * \param[in]     line    One line of a target list string
4c8e44
+ * \parma[in]     len     String length of line
4c8e44
+ * \param[in,out] output  List to add newly allocated target name to
4c8e44
+ */
4c8e44
+static void
4c8e44
+parse_list_line(const char *line, int len, GList **output)
4c8e44
+{
4c8e44
+    size_t i = 0;
4c8e44
+    size_t entry_start = 0;
4c8e44
+
4c8e44
+    /* Skip complaints about additional parameters device doesn't understand
4c8e44
+     *
4c8e44
+     * @TODO Document or eliminate the implied restriction of target names
4c8e44
+     */
4c8e44
+    if (strstr(line, "invalid") || strstr(line, "variable")) {
4c8e44
+        crm_debug("Skipping list output line: %s", line);
4c8e44
+        return;
4c8e44
+    }
4c8e44
+
4c8e44
+    // Process line content, character by character
4c8e44
+    for (i = 0; i <= len; i++) {
4c8e44
+
4c8e44
+        if (isspace(line[i]) || (line[i] == ',') || (line[i] == ';')
4c8e44
+            || (line[i] == '\0')) {
4c8e44
+            // We've found a separator (i.e. the end of an entry)
4c8e44
+
4c8e44
+            int rc = 0;
4c8e44
+            char *entry = NULL;
4c8e44
+
4c8e44
+            if (i == entry_start) {
4c8e44
+                // Skip leading and sequential separators
4c8e44
+                entry_start = i + 1;
4c8e44
+                continue;
4c8e44
+            }
4c8e44
+
4c8e44
+            entry = calloc(i - entry_start + 1, sizeof(char));
4c8e44
+            CRM_ASSERT(entry != NULL);
4c8e44
+
4c8e44
+            /* Read entry, stopping at first separator
4c8e44
+             *
4c8e44
+             * @TODO Document or eliminate these character restrictions
4c8e44
+             */
4c8e44
+            rc = sscanf(line + entry_start, "%[a-zA-Z0-9_-.]", entry);
4c8e44
+            if (rc != 1) {
4c8e44
+                crm_warn("Could not parse list output entry: %s "
4c8e44
+                         CRM_XS " entry_start=%d position=%d",
4c8e44
+                         line + entry_start, entry_start, i);
4c8e44
+                free(entry);
4c8e44
+
4c8e44
+            } else if (safe_str_eq(entry, "on") || safe_str_eq(entry, "off")) {
4c8e44
+                /* Some agents print the target status in the list output,
4c8e44
+                 * though none are known now (the separate list-status command
4c8e44
+                 * is used for this, but it can also print "UNKNOWN"). To handle
4c8e44
+                 * this possibility, skip such entries.
4c8e44
+                 *
4c8e44
+                 * @TODO Document or eliminate the implied restriction of target
4c8e44
+                 * names.
4c8e44
+                 */
4c8e44
+                free(entry);
4c8e44
+
4c8e44
+            } else {
4c8e44
+                // We have a valid entry
4c8e44
+                *output = g_list_append(*output, entry);
4c8e44
+            }
4c8e44
+            entry_start = i + 1;
4c8e44
+        }
4c8e44
+    }
4c8e44
+}
4c8e44
+
4c8e44
+/*!
4c8e44
+ * \internal
4c8e44
+ * \brief Parse a list of targets from a string
4c8e44
+ *
4c8e44
+ * \param[in] list_output  Target list as a string
4c8e44
+ *
4c8e44
+ * \return List of target names
4c8e44
+ * \note The target list string format is flexible, to allow for user-specified
4c8e44
+ *       lists such pcmk_host_list and the output of an agent's list action
4c8e44
+ *       (whether direct or via the API, which escapes newlines). There may be
4c8e44
+ *       multiple lines, separated by either a newline or an escaped newline
4c8e44
+ *       (backslash n). Each line may have one or more target names, separated
4c8e44
+ *       by any combination of whitespace, commas, and semi-colons. Lines
4c8e44
+ *       containing "invalid" or "variable" will be ignored entirely. Target
4c8e44
+ *       names "on" or "off" (case-insensitive) will be ignored. Target names
4c8e44
+ *       may contain only alphanumeric characters, underbars (_), dashes (-),
4c8e44
+ *       and dots (.) (if any other character occurs in the name, it and all
4c8e44
+ *       subsequent characters in the name will be ignored).
4c8e44
+ * \note The caller is responsible for freeing the result with
4c8e44
+ *       g_list_free_full(result, free).
4c8e44
+ */
4c8e44
+GList *
4c8e44
+stonith__parse_targets(const char *target_spec)
4c8e44
+{
4c8e44
+    GList *targets = NULL;
4c8e44
+
4c8e44
+    if (target_spec != NULL) {
4c8e44
+        size_t out_len = strlen(target_spec);
4c8e44
+        size_t line_start = 0; // Starting index of line being processed
4c8e44
+
4c8e44
+        for (size_t i = 0; i <= out_len; ++i) {
4c8e44
+            if ((target_spec[i] == '\n') || (target_spec[i] == '\0')
4c8e44
+                || ((target_spec[i] == '\\') && (target_spec[i + 1] == 'n'))) {
4c8e44
+                // We've reached the end of one line of output
4c8e44
+
4c8e44
+                int len = i - line_start;
4c8e44
+
4c8e44
+                if (len > 0) {
4c8e44
+                    char *line = strndup(target_spec + line_start, len);
4c8e44
+
4c8e44
+                    line[len] = '\0'; // Because it might be a newline
4c8e44
+                    parse_list_line(line, len, &targets;;
4c8e44
+                    free(line);
4c8e44
+                }
4c8e44
+                if (target_spec[i] == '\\') {
4c8e44
+                    ++i; // backslash-n takes up two positions
4c8e44
+                }
4c8e44
+                line_start = i + 1;
4c8e44
+            }
4c8e44
+        }
4c8e44
+    }
4c8e44
+    return targets;
4c8e44
+}
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 60ad7730fbf34c1f67700bace39a083c0e3d1c31 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Mon, 10 Jun 2019 16:13:29 -0500
4c8e44
Subject: [PATCH 09/11] Fix: tools: stonith_admin --list-targets should show
4c8e44
 what fencer would use
4c8e44
4c8e44
This fixes both a regression in 2.0.2 and a pre-existing issue before that.
4c8e44
4c8e44
Before 2.0.2's 52f614aa, stonith_admin --list-targets would print each line of
4c8e44
output from the fence agent's list action, with any commas and semi-colons
4c8e44
removed. After that, it would only print lines that had three values separated
4c8e44
by spaces.
4c8e44
4c8e44
In practice, fence agents have some variety in list action output, which is not
4c8e44
yet standardized by the fence agent API. Only fence_xvm is known to use the
4c8e44
three space-separated values. Most agents output the target name and an alias
4c8e44
separated by a comma.
4c8e44
4c8e44
The earlier behavior would actually be awkward in the comma-separated case,
4c8e44
since the target name and alias would be run together with no separator.
4c8e44
4c8e44
Neither behaviors matched what was actually used by the fencer.
4c8e44
4c8e44
This commit refactors to use the new stonith__parse_targets() function, to show
4c8e44
the same list the fencer would use. It also fixes a few related issues:
4c8e44
4c8e44
* Memory was not properly freed
4c8e44
4c8e44
* No list wrapper would be printed if the list were empty
4c8e44
4c8e44
* stonith_admin's XML output did not match its schema (the tool would output a
4c8e44
  <fence-target> element, while the schema had <target>). Now, we abandon the
4c8e44
  custom element and use the generic <item> schema instead. While technically
4c8e44
  this could be considered backward-incompatible, it's not really, because the
4c8e44
  schema didn't match to begin with. Also, the API XML schema is still
4c8e44
  considered experimental.
4c8e44
4c8e44
* Not really a problem, but since we now have the generic <item> schema,
4c8e44
  stonith_admin uses this in place of its former dedicated <item> schema.
4c8e44
  The only difference is the former allows arbitrary strings while the
4c8e44
  latter required NCName, but the reuse is more useful than type validation.
4c8e44
---
4c8e44
 lib/fencing/st_output.c       | 28 ----------------
4c8e44
 tools/stonith_admin.c         | 52 +++++-------------------------
4c8e44
 xml/api/stonith_admin-1.1.rng | 75 +++++++++++++++++++++++++++++++++++++++++++
4c8e44
 3 files changed, 83 insertions(+), 72 deletions(-)
4c8e44
 create mode 100644 xml/api/stonith_admin-1.1.rng
4c8e44
4c8e44
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
4c8e44
index a8d0a60..0ceb699 100644
4c8e44
--- a/lib/fencing/st_output.c
4c8e44
+++ b/lib/fencing/st_output.c
4c8e44
@@ -17,32 +17,6 @@
4c8e44
 #include <crm/fencing/internal.h>
4c8e44
 
4c8e44
 static int
4c8e44
-fence_target_text(pcmk__output_t *out, va_list args) {
4c8e44
-    const char *hostname = va_arg(args, const char *);
4c8e44
-    const char *uuid = va_arg(args, const char *);
4c8e44
-    const char *status = va_arg(args, const char *);
4c8e44
-
4c8e44
-    pcmk__indented_printf(out, "%s\t%s\t%s\n", hostname, uuid, status);
4c8e44
-    return 0;
4c8e44
-}
4c8e44
-
4c8e44
-static int
4c8e44
-fence_target_xml(pcmk__output_t *out, va_list args) {
4c8e44
-    xmlNodePtr node = NULL;
4c8e44
-    const char *hostname = va_arg(args, const char *);
4c8e44
-    const char *uuid = va_arg(args, const char *);
4c8e44
-    const char *status = va_arg(args, const char *);
4c8e44
-
4c8e44
-    node = xmlNewNode(NULL, (pcmkXmlStr) "target");
4c8e44
-    xmlSetProp(node, (pcmkXmlStr) "hostname", (pcmkXmlStr) hostname);
4c8e44
-    xmlSetProp(node, (pcmkXmlStr) "uuid", (pcmkXmlStr) uuid);
4c8e44
-    xmlSetProp(node, (pcmkXmlStr) "status", (pcmkXmlStr) status);
4c8e44
-
4c8e44
-    pcmk__xml_add_node(out, node);
4c8e44
-    return 0;
4c8e44
-}
4c8e44
-
4c8e44
-static int
4c8e44
 last_fenced_text(pcmk__output_t *out, va_list args) {
4c8e44
     const char *target = va_arg(args, const char *);
4c8e44
     time_t when = va_arg(args, time_t);
4c8e44
@@ -216,8 +190,6 @@ validate_agent_xml(pcmk__output_t *out, va_list args) {
4c8e44
 }
4c8e44
 
4c8e44
 static pcmk__message_entry_t fmt_functions[] = {
4c8e44
-    { "fence-target", "text", fence_target_text },
4c8e44
-    { "fence-target", "xml", fence_target_xml },
4c8e44
     { "last-fenced", "text", last_fenced_text },
4c8e44
     { "last-fenced", "xml", last_fenced_xml },
4c8e44
     { "stonith-event", "text", stonith_event_text },
4c8e44
diff --git a/tools/stonith_admin.c b/tools/stonith_admin.c
4c8e44
index 6be66c6..a7551fd 100644
4c8e44
--- a/tools/stonith_admin.c
4c8e44
+++ b/tools/stonith_admin.c
4c8e44
@@ -635,53 +635,17 @@ main(int argc, char **argv)
4c8e44
             break;
4c8e44
         case 's':
4c8e44
             rc = st->cmds->list(st, st_opts, device, &lists, timeout);
4c8e44
-            if (rc == 0 && lists) {
4c8e44
-                char *head = lists;
4c8e44
-                char *eol = NULL;
4c8e44
+            if (rc == 0) {
4c8e44
+                GList *targets = stonith__parse_targets(lists);
4c8e44
 
4c8e44
                 out->begin_list(out, "Fence targets", "fence target", "fence targets");
4c8e44
-
4c8e44
-                do {
4c8e44
-                    char *line = NULL;
4c8e44
-                    char *elem = NULL;
4c8e44
-
4c8e44
-                    char *hostname = NULL;
4c8e44
-                    char *uuid = NULL;
4c8e44
-                    char *status = NULL;
4c8e44
-
4c8e44
-                    eol = strstr(head, "\\n");
4c8e44
-                    line = strndup(head, eol-head);
4c8e44
-
4c8e44
-                    while ((elem = strsep(&line, " ")) != NULL) {
4c8e44
-                        if (strcmp(elem, "") == 0) {
4c8e44
-                            continue;
4c8e44
-                        }
4c8e44
-
4c8e44
-                        if (hostname == NULL) {
4c8e44
-                            hostname = elem;
4c8e44
-                        } else if (uuid == NULL) {
4c8e44
-                            uuid = elem;
4c8e44
-                        } else if (status == NULL) {
4c8e44
-                            char *end = NULL;
4c8e44
-                            status = elem;
4c8e44
-
4c8e44
-                            end = strchr(status, '\n');
4c8e44
-                            if (end != NULL) {
4c8e44
-                                *end = '\0';
4c8e44
-                            }
4c8e44
-                        }
4c8e44
-                    }
4c8e44
-
4c8e44
-                    if (hostname != NULL && uuid != NULL && status != NULL) {
4c8e44
-                        out->message(out, "fence-target", hostname, uuid, status);
4c8e44
-                    }
4c8e44
-
4c8e44
-                    free(line);
4c8e44
-
4c8e44
-                    head = eol+2;
4c8e44
-                } while (eol != NULL);
4c8e44
-
4c8e44
+                while (targets != NULL) {
4c8e44
+                    out->list_item(out, NULL, (const char *) targets->data);
4c8e44
+                    targets = targets->next;
4c8e44
+                }
4c8e44
                 out->end_list(out);
4c8e44
+                free(lists);
4c8e44
+
4c8e44
             } else if (rc != 0) {
4c8e44
                 fprintf(stderr, "List command returned error. rc : %d\n", rc);
4c8e44
             }
4c8e44
diff --git a/xml/api/stonith_admin-1.1.rng b/xml/api/stonith_admin-1.1.rng
4c8e44
new file mode 100644
4c8e44
index 0000000..997670f
4c8e44
--- /dev/null
4c8e44
+++ b/xml/api/stonith_admin-1.1.rng
4c8e44
@@ -0,0 +1,75 @@
4c8e44
+
4c8e44
+
4c8e44
+         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
4c8e44
+
4c8e44
+    <start>
4c8e44
+        <ref name="element-stonith-admin"/>
4c8e44
+    </start>
4c8e44
+
4c8e44
+    <define name="element-stonith-admin">
4c8e44
+        <choice>
4c8e44
+            <ref name="stonith-admin-list" />
4c8e44
+            <ref name="element-last-fenced" />
4c8e44
+            <ref name="element-validation" />
4c8e44
+            <element name="metadata"> <text /> </element>
4c8e44
+        </choice>
4c8e44
+    </define>
4c8e44
+
4c8e44
+    <define name="stonith-admin-list">
4c8e44
+        <element name="list">
4c8e44
+            <attribute name="name"> <text /> </attribute>
4c8e44
+            <attribute name="count"> <data type="nonNegativeInteger" /> </attribute>
4c8e44
+            <choice>
4c8e44
+                <empty/>
4c8e44
+                <oneOrMore>
4c8e44
+                    <externalRef href="item-1.1.rng"/>
4c8e44
+                </oneOrMore>
4c8e44
+                <oneOrMore>
4c8e44
+                    <ref name="fencing-history-event" />
4c8e44
+                </oneOrMore>
4c8e44
+            </choice>
4c8e44
+        </element>
4c8e44
+    </define>
4c8e44
+
4c8e44
+    <define name="element-last-fenced">
4c8e44
+        <element name="last-fenced">
4c8e44
+            <attribute name="target"> <text /> </attribute>
4c8e44
+            <attribute name="when"> <text /> </attribute>
4c8e44
+        </element>
4c8e44
+    </define>
4c8e44
+
4c8e44
+    <define name="element-validation">
4c8e44
+        <element name="validate">
4c8e44
+            <attribute name="agent"> <text /> </attribute>
4c8e44
+            <attribute name="valid"> <data type="boolean" /> </attribute>
4c8e44
+            <optional>
4c8e44
+                <externalRef href="command-output-1.0.rng" />
4c8e44
+            </optional>
4c8e44
+        </element>
4c8e44
+    </define>
4c8e44
+
4c8e44
+    <define name="fencing-history-event">
4c8e44
+        <element name="fence_event">
4c8e44
+            <attribute name="status">
4c8e44
+                <choice>
4c8e44
+                    <value>failed</value>
4c8e44
+                    <value>success</value>
4c8e44
+                    <value>pending</value>
4c8e44
+                </choice>
4c8e44
+            </attribute>
4c8e44
+            <optional>
4c8e44
+                <attribute name="extended-status"> <text /> </attribute>
4c8e44
+            </optional>
4c8e44
+            <optional>
4c8e44
+                <attribute name="delegate"> <text /> </attribute>
4c8e44
+            </optional>
4c8e44
+            <attribute name="action"> <text /> </attribute>
4c8e44
+            <attribute name="target"> <text /> </attribute>
4c8e44
+            <attribute name="client"> <text /> </attribute>
4c8e44
+            <attribute name="origin"> <text /> </attribute>
4c8e44
+            <optional>
4c8e44
+                <attribute name="completed"> <text /> </attribute>
4c8e44
+            </optional>
4c8e44
+        </element>
4c8e44
+    </define>
4c8e44
+</grammar>
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 8cc030c045e0a0b43a2a0dcfec5541e5e07faed3 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Mon, 10 Jun 2019 17:41:32 -0500
4c8e44
Subject: [PATCH 10/11] Fix: libcrmcommon: add stderr source correctly when
4c8e44
 outputting XML
4c8e44
4c8e44
---
4c8e44
 lib/common/output_xml.c | 2 +-
4c8e44
 1 file changed, 1 insertion(+), 1 deletion(-)
4c8e44
4c8e44
diff --git a/lib/common/output_xml.c b/lib/common/output_xml.c
4c8e44
index c93d66c..994af43 100644
4c8e44
--- a/lib/common/output_xml.c
4c8e44
+++ b/lib/common/output_xml.c
4c8e44
@@ -130,7 +130,7 @@ xml_subprocess_output(pcmk__output_t *out, int exit_status,
4c8e44
     if (proc_stderr != NULL) {
4c8e44
         child_node = xmlNewTextChild(node, NULL, (pcmkXmlStr) "output",
4c8e44
                                      (pcmkXmlStr) proc_stderr);
4c8e44
-        xmlSetProp(node, (pcmkXmlStr) "source", (pcmkXmlStr) "stderr");
4c8e44
+        xmlSetProp(child_node, (pcmkXmlStr) "source", (pcmkXmlStr) "stderr");
4c8e44
     }
4c8e44
 
4c8e44
     pcmk__xml_add_node(out, node);
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44
4c8e44
4c8e44
From 4ce8272fde2605099b9d4bb1e211bc66c4f79f90 Mon Sep 17 00:00:00 2001
4c8e44
From: Ken Gaillot <kgaillot@redhat.com>
4c8e44
Date: Wed, 12 Jun 2019 19:56:09 -0500
4c8e44
Subject: [PATCH 11/11] Test: CTS: update pattern for changed log message
4c8e44
4c8e44
changed in 0a884f32
4c8e44
---
4c8e44
 cts/CM_common.py | 4 ++--
4c8e44
 cts/patterns.py  | 2 +-
4c8e44
 2 files changed, 3 insertions(+), 3 deletions(-)
4c8e44
4c8e44
diff --git a/cts/CM_common.py b/cts/CM_common.py
4c8e44
index 0112fec..b7ff223 100755
4c8e44
--- a/cts/CM_common.py
4c8e44
+++ b/cts/CM_common.py
4c8e44
@@ -12,7 +12,7 @@ from __future__ import print_function, unicode_literals, absolute_import, divisi
4c8e44
 __copyright__ = """Original Author: Huang Zhen <zhenhltc@cn.ibm.com>
4c8e44
 Copyright 2004 International Business Machines
4c8e44
 
4c8e44
-with later changes copyright 2004-2018 the Pacemaker project contributors.
4c8e44
+with later changes copyright 2004-2019 the Pacemaker project contributors.
4c8e44
 The version control history for this file may have further details.
4c8e44
 """
4c8e44
 __license__ = "GNU General Public License version 2 or later (GPLv2+) WITHOUT ANY WARRANTY"
4c8e44
@@ -318,7 +318,7 @@ class crm_common(ClusterManager):
4c8e44
 
4c8e44
         stonith_ignore = [
4c8e44
             r"Updating failcount for child_DoFencing",
4c8e44
-            r"(ERROR|error).*: Sign-in failed: triggered a retry",
4c8e44
+            r"error.*: Fencer connection failed \(will retry\)",
4c8e44
             "pacemaker-execd.*(ERROR|error): stonithd_receive_ops_result failed.",
4c8e44
              ]
4c8e44
 
4c8e44
diff --git a/cts/patterns.py b/cts/patterns.py
4c8e44
index 1bdace0..1b86ee7 100644
4c8e44
--- a/cts/patterns.py
4c8e44
+++ b/cts/patterns.py
4c8e44
@@ -308,7 +308,7 @@ class crm_corosync(BasePatterns):
4c8e44
         self.components["pacemaker-fenced-ignore"] = [
4c8e44
             r"error:.*Connection to (fencer|stonith-ng).* (closed|failed|lost)",
4c8e44
             r"crit:.*Fencing daemon connection failed",
4c8e44
-            r"error:.*Sign-in failed: triggered a retry",
4c8e44
+            r"error:.*Fencer connection failed \(will retry\)",
4c8e44
             r"Connection to (fencer|stonith-ng) failed, finalizing .* pending operations",
4c8e44
             r"pacemaker-controld.*:\s+Result of .* operation for Fencing.*Error",
4c8e44
         ]
4c8e44
-- 
4c8e44
1.8.3.1
4c8e44