1.1.13-3: Update to Pacemaker-1.1.13 post-release + patches
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
parent
052060c4c9
commit
dff8d9929d
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,16 +1,3 @@
|
||||
/Pacemaker-1.1.4.tar.bz2
|
||||
/Pacemaker-1.1.5.tar.bz2
|
||||
/Pacemaker-1.1.6.tar.bz2
|
||||
/ClusterLabs-pacemaker-89678d4.tar.gz
|
||||
/ClusterLabs-pacemaker-bc7c125.tar.gz
|
||||
/ClusterLabs-pacemaker-148fccf.tar.gz
|
||||
/ClusterLabs-pacemaker-7742926.tar.gz
|
||||
/ClusterLabs-pacemaker-Pacemaker-1.1.7.tar.gz
|
||||
/ClusterLabs-pacemaker-b5b0a7b.tar.gz
|
||||
/ClusterLabs-pacemaker-c72d970.tar.gz
|
||||
/ClusterLabs-pacemaker-394e906.tar.gz
|
||||
/ClusterLabs-pacemaker-70ad9fa.tar.gz
|
||||
/ClusterLabs-pacemaker-781a388.tar.gz
|
||||
/ClusterLabs-pacemaker-9d39a6b.tar.gz
|
||||
/pacemaker-a9c81774b89f21f990be255f9862446d1a38afee.tar.gz
|
||||
/pacemaker-6052cd16c2f455809f8088af76ce86483bf98353.tar.gz
|
||||
/ClusterLabs-pacemaker-*.tar.gz
|
||||
/pacemaker-*.tar.gz
|
||||
/nagios-agents-metadata-*.tar.gz
|
||||
|
@ -0,0 +1,82 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Fri, 14 Aug 2015 09:43:32 +1000
|
||||
Subject: [PATCH] Fix: crm_resource: Correctly check if a resource is unmanaged
|
||||
or has a target-role
|
||||
|
||||
(cherry picked from commit 3ff29dbe2cab872b452c4580736d23d1f69736fa)
|
||||
---
|
||||
tools/crm_resource.c | 2 +-
|
||||
tools/crm_resource_runtime.c | 31 ++++++++++++++++++-------------
|
||||
2 files changed, 19 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
||||
index 2fce3b7..156bbea 100644
|
||||
--- a/tools/crm_resource.c
|
||||
+++ b/tools/crm_resource.c
|
||||
@@ -888,7 +888,7 @@ main(int argc, char **argv)
|
||||
rsc = uber_parent(rsc);
|
||||
}
|
||||
|
||||
- crm_debug("Re-checking the state of %s on %s", rsc_id, host_uname);
|
||||
+ crm_debug("Re-checking the state of %s for %s on %s", rsc->id, rsc_id, host_uname);
|
||||
if(rsc) {
|
||||
crmd_replies_needed = 0;
|
||||
rc = cli_resource_delete(cib_conn, crmd_channel, host_uname, rsc, &data_set);
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index a270cbf..f260e19 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -616,35 +616,40 @@ cli_resource_delete(cib_t *cib_conn, crm_ipc_t * crmd_channel, const char *host_
|
||||
void
|
||||
cli_resource_check(cib_t * cib_conn, resource_t *rsc)
|
||||
{
|
||||
-
|
||||
+ int need_nl = 0;
|
||||
char *role_s = NULL;
|
||||
char *managed = NULL;
|
||||
resource_t *parent = uber_parent(rsc);
|
||||
|
||||
- find_resource_attr(cib_conn, XML_ATTR_ID, parent->id,
|
||||
- XML_TAG_META_SETS, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed);
|
||||
+ find_resource_attr(cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id,
|
||||
+ NULL, NULL, NULL, XML_RSC_ATTR_MANAGED, &managed);
|
||||
|
||||
- find_resource_attr(cib_conn, XML_ATTR_ID, parent->id,
|
||||
- XML_TAG_META_SETS, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &role_s);
|
||||
+ find_resource_attr(cib_conn, XML_NVPAIR_ATTR_VALUE, parent->id,
|
||||
+ NULL, NULL, NULL, XML_RSC_ATTR_TARGET_ROLE, &role_s);
|
||||
|
||||
- if(managed == NULL) {
|
||||
- managed = strdup("1");
|
||||
- }
|
||||
- if(crm_is_true(managed) == FALSE) {
|
||||
- printf("\n\t*Resource %s is configured to not be managed by the cluster\n", parent->id);
|
||||
- }
|
||||
if(role_s) {
|
||||
enum rsc_role_e role = text2role(role_s);
|
||||
if(role == RSC_ROLE_UNKNOWN) {
|
||||
// Treated as if unset
|
||||
|
||||
} else if(role == RSC_ROLE_STOPPED) {
|
||||
- printf("\n\t* The configuration specifies that '%s' should remain stopped\n", parent->id);
|
||||
+ printf("\n * The configuration specifies that '%s' should remain stopped\n", parent->id);
|
||||
+ need_nl++;
|
||||
|
||||
} else if(parent->variant > pe_clone && role != RSC_ROLE_MASTER) {
|
||||
- printf("\n\t* The configuration specifies that '%s' should not be promoted\n", parent->id);
|
||||
+ printf("\n * The configuration specifies that '%s' should not be promoted\n", parent->id);
|
||||
+ need_nl++;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if(managed && crm_is_true(managed) == FALSE) {
|
||||
+ printf("%s * The configuration prevents the cluster from stopping or starting '%s' (unmanaged)\n", need_nl == 0?"\n":"", parent->id);
|
||||
+ need_nl++;
|
||||
+ }
|
||||
+
|
||||
+ if(need_nl) {
|
||||
+ printf("\n");
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
328
0005-Fix-PE-Bug-cl-5247-Imply-resources-running-on-a-cont.patch
Normal file
328
0005-Fix-PE-Bug-cl-5247-Imply-resources-running-on-a-cont.patch
Normal file
@ -0,0 +1,328 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 18 Aug 2015 10:30:49 +1000
|
||||
Subject: [PATCH] Fix: PE: Bug cl#5247 - Imply resources running on a container
|
||||
are stopped when the container is stopped
|
||||
|
||||
(cherry picked from commit e10eff1902d5b451454e2d467ee337c964f536ab)
|
||||
---
|
||||
lib/pengine/unpack.c | 29 ++++++++++++++++++++---------
|
||||
pengine/allocate.c | 17 +++++++++++++++++
|
||||
pengine/graph.c | 7 ++++++-
|
||||
pengine/test10/bug-rh-1097457.dot | 2 ++
|
||||
pengine/test10/bug-rh-1097457.exp | 12 ++++++++++--
|
||||
pengine/test10/bug-rh-1097457.summary | 10 +++++-----
|
||||
pengine/test10/whitebox-fail1.dot | 1 +
|
||||
pengine/test10/whitebox-fail1.exp | 6 +++++-
|
||||
pengine/test10/whitebox-fail1.summary | 8 ++++----
|
||||
pengine/test10/whitebox-fail2.dot | 1 +
|
||||
pengine/test10/whitebox-fail2.exp | 6 +++++-
|
||||
pengine/test10/whitebox-fail2.summary | 8 ++++----
|
||||
12 files changed, 80 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
|
||||
index 106c674..0f83be4 100644
|
||||
--- a/lib/pengine/unpack.c
|
||||
+++ b/lib/pengine/unpack.c
|
||||
@@ -44,7 +44,7 @@ CRM_TRACE_INIT_DATA(pe_status);
|
||||
|
||||
gboolean unpack_rsc_op(resource_t * rsc, node_t * node, xmlNode * xml_op,
|
||||
enum action_fail_response *failed, pe_working_set_t * data_set);
|
||||
-static gboolean determine_remote_online_status(node_t * this_node);
|
||||
+static gboolean determine_remote_online_status(pe_working_set_t * data_set, node_t * this_node);
|
||||
|
||||
static gboolean
|
||||
is_dangling_container_remote_node(node_t *node)
|
||||
@@ -73,6 +73,8 @@ pe_fence_node(pe_working_set_t * data_set, node_t * node, const char *reason)
|
||||
if (is_set(rsc->flags, pe_rsc_failed) == FALSE) {
|
||||
crm_warn("Remote node %s will be fenced by recovering container resource %s",
|
||||
node->details->uname, rsc->id, reason);
|
||||
+ /* node->details->unclean = TRUE; */
|
||||
+ node->details->remote_requires_reset = TRUE;
|
||||
set_bit(rsc->flags, pe_rsc_failed);
|
||||
}
|
||||
} else if (is_dangling_container_remote_node(node)) {
|
||||
@@ -1157,7 +1159,7 @@ unpack_remote_status(xmlNode * status, pe_working_set_t * data_set)
|
||||
if ((this_node == NULL) || (is_remote_node(this_node) == FALSE)) {
|
||||
continue;
|
||||
}
|
||||
- determine_remote_online_status(this_node);
|
||||
+ determine_remote_online_status(data_set, this_node);
|
||||
}
|
||||
|
||||
/* process attributes */
|
||||
@@ -1366,7 +1368,7 @@ determine_online_status_fencing(pe_working_set_t * data_set, xmlNode * node_stat
|
||||
}
|
||||
|
||||
static gboolean
|
||||
-determine_remote_online_status(node_t * this_node)
|
||||
+determine_remote_online_status(pe_working_set_t * data_set, node_t * this_node)
|
||||
{
|
||||
resource_t *rsc = this_node->details->remote_rsc;
|
||||
resource_t *container = NULL;
|
||||
@@ -1393,13 +1395,21 @@ determine_remote_online_status(node_t * this_node)
|
||||
}
|
||||
|
||||
/* Now check all the failure conditions. */
|
||||
- if (is_set(rsc->flags, pe_rsc_failed) ||
|
||||
- (rsc->role == RSC_ROLE_STOPPED) ||
|
||||
- (container && is_set(container->flags, pe_rsc_failed)) ||
|
||||
- (container && container->role == RSC_ROLE_STOPPED)) {
|
||||
+ if(container && is_set(container->flags, pe_rsc_failed)) {
|
||||
+ crm_trace("Remote node %s is set to UNCLEAN. rsc failed.", this_node->details->id);
|
||||
+ this_node->details->online = FALSE;
|
||||
+ this_node->details->remote_requires_reset = TRUE;
|
||||
|
||||
- crm_trace("Remote node %s is set to OFFLINE. node is stopped or rsc failed.", this_node->details->id);
|
||||
+ } else if(is_set(rsc->flags, pe_rsc_failed)) {
|
||||
+ crm_trace("Remote node %s is set to OFFLINE. rsc failed.", this_node->details->id);
|
||||
this_node->details->online = FALSE;
|
||||
+
|
||||
+ } else if (rsc->role == RSC_ROLE_STOPPED
|
||||
+ || (container && container->role == RSC_ROLE_STOPPED)) {
|
||||
+
|
||||
+ crm_trace("Remote node %s is set to OFFLINE. node is stopped.", this_node->details->id);
|
||||
+ this_node->details->online = FALSE;
|
||||
+ this_node->details->remote_requires_reset = FALSE;
|
||||
}
|
||||
|
||||
remote_online_done:
|
||||
@@ -3375,7 +3385,8 @@ find_operations(const char *rsc, const char *node, gboolean active_filter,
|
||||
continue;
|
||||
|
||||
} else if (is_remote_node(this_node)) {
|
||||
- determine_remote_online_status(this_node);
|
||||
+ determine_remote_online_status(data_set, this_node);
|
||||
+
|
||||
} else {
|
||||
determine_online_status(node_state, this_node, data_set);
|
||||
}
|
||||
diff --git a/pengine/allocate.c b/pengine/allocate.c
|
||||
index c2e56f9..65ae05d 100644
|
||||
--- a/pengine/allocate.c
|
||||
+++ b/pengine/allocate.c
|
||||
@@ -1406,6 +1406,23 @@ stage6(pe_working_set_t * data_set)
|
||||
|
||||
/* remote-nodes associated with a container resource (such as a vm) are not fenced */
|
||||
if (is_container_remote_node(node)) {
|
||||
+ /* Guest */
|
||||
+ if (need_stonith
|
||||
+ && node->details->remote_requires_reset
|
||||
+ && pe_can_fence(data_set, node)) {
|
||||
+ resource_t *container = node->details->remote_rsc->container;
|
||||
+ char *key = stop_key(container);
|
||||
+ GListPtr stop_list = find_actions(container->actions, key, NULL);
|
||||
+
|
||||
+ crm_info("Impliying node %s is down when container %s is stopped (%p)",
|
||||
+ node->details->uname, container->id, stop_list);
|
||||
+ if(stop_list) {
|
||||
+ stonith_constraints(node, stop_list->data, data_set);
|
||||
+ }
|
||||
+
|
||||
+ g_list_free(stop_list);
|
||||
+ free(key);
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
|
||||
diff --git a/pengine/graph.c b/pengine/graph.c
|
||||
index 3d832f0..a50f15b 100644
|
||||
--- a/pengine/graph.c
|
||||
+++ b/pengine/graph.c
|
||||
@@ -697,7 +697,12 @@ stonith_constraints(node_t * node, action_t * stonith_op, pe_working_set_t * dat
|
||||
for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) {
|
||||
resource_t *rsc = (resource_t *) lpc->data;
|
||||
|
||||
- rsc_stonith_ordering(rsc, stonith_op, data_set);
|
||||
+ if(stonith_op->rsc == NULL) {
|
||||
+ rsc_stonith_ordering(rsc, stonith_op, data_set);
|
||||
+
|
||||
+ } else if(stonith_op->rsc != rsc && stonith_op->rsc != rsc->container) {
|
||||
+ rsc_stonith_ordering(rsc, stonith_op, data_set);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/pengine/test10/bug-rh-1097457.dot b/pengine/test10/bug-rh-1097457.dot
|
||||
index 666099c..078d177 100644
|
||||
--- a/pengine/test10/bug-rh-1097457.dot
|
||||
+++ b/pengine/test10/bug-rh-1097457.dot
|
||||
@@ -49,10 +49,12 @@ digraph "g" {
|
||||
"VM2_start_0 lama3" [ style=bold color="green" fontcolor="black"]
|
||||
"VM2_stop_0 lama3" -> "FAKE4-IP_stop_0 lamaVM2" [ style = bold]
|
||||
"VM2_stop_0 lama3" -> "FAKE4_stop_0 lamaVM2" [ style = bold]
|
||||
+"VM2_stop_0 lama3" -> "FAKE6-clone_stop_0" [ style = bold]
|
||||
"VM2_stop_0 lama3" -> "FAKE6_stop_0 lamaVM2" [ style = bold]
|
||||
"VM2_stop_0 lama3" -> "FSlun3_stop_0 lamaVM2" [ style = bold]
|
||||
"VM2_stop_0 lama3" -> "VM2_start_0 lama3" [ style = bold]
|
||||
"VM2_stop_0 lama3" -> "all_stopped" [ style = bold]
|
||||
+"VM2_stop_0 lama3" -> "lamaVM2-G4_stop_0" [ style = bold]
|
||||
"VM2_stop_0 lama3" [ style=bold color="green" fontcolor="black"]
|
||||
"all_stopped" [ style=bold color="green" fontcolor="orange"]
|
||||
"lamaVM2-G4_running_0" [ style=bold color="green" fontcolor="orange"]
|
||||
diff --git a/pengine/test10/bug-rh-1097457.exp b/pengine/test10/bug-rh-1097457.exp
|
||||
index 36af9f3..175f413 100644
|
||||
--- a/pengine/test10/bug-rh-1097457.exp
|
||||
+++ b/pengine/test10/bug-rh-1097457.exp
|
||||
@@ -119,7 +119,11 @@
|
||||
<attributes CRM_meta_timeout="20000" />
|
||||
</pseudo_event>
|
||||
</action_set>
|
||||
- <inputs/>
|
||||
+ <inputs>
|
||||
+ <trigger>
|
||||
+ <rsc_op id="40" operation="stop" operation_key="VM2_stop_0" on_node="lama3" on_node_uuid="2"/>
|
||||
+ </trigger>
|
||||
+ </inputs>
|
||||
</synapse>
|
||||
<synapse id="9">
|
||||
<action_set>
|
||||
@@ -331,7 +335,11 @@
|
||||
<attributes CRM_meta_clone_max="3" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
|
||||
</pseudo_event>
|
||||
</action_set>
|
||||
- <inputs/>
|
||||
+ <inputs>
|
||||
+ <trigger>
|
||||
+ <rsc_op id="40" operation="stop" operation_key="VM2_stop_0" on_node="lama3" on_node_uuid="2"/>
|
||||
+ </trigger>
|
||||
+ </inputs>
|
||||
</synapse>
|
||||
<synapse id="22" priority="1000000">
|
||||
<action_set>
|
||||
diff --git a/pengine/test10/bug-rh-1097457.summary b/pengine/test10/bug-rh-1097457.summary
|
||||
index e2f235d..c8751ae 100644
|
||||
--- a/pengine/test10/bug-rh-1097457.summary
|
||||
+++ b/pengine/test10/bug-rh-1097457.summary
|
||||
@@ -39,17 +39,17 @@ Transition Summary:
|
||||
* Restart lamaVM2 (Started lama3)
|
||||
|
||||
Executing cluster transition:
|
||||
- * Pseudo action: lamaVM2-G4_stop_0
|
||||
- * Pseudo action: FAKE6-clone_stop_0
|
||||
* Resource action: lamaVM2 stop on lama3
|
||||
* Resource action: VM2 stop on lama3
|
||||
+ * Pseudo action: lamaVM2-G4_stop_0
|
||||
* Pseudo action: FAKE4-IP_stop_0
|
||||
- * Pseudo action: FAKE6_stop_0
|
||||
- * Pseudo action: FAKE6-clone_stopped_0
|
||||
- * Pseudo action: FAKE6-clone_start_0
|
||||
+ * Pseudo action: FAKE6-clone_stop_0
|
||||
* Resource action: VM2 start on lama3
|
||||
* Resource action: VM2 monitor=10000 on lama3
|
||||
* Pseudo action: FAKE4_stop_0
|
||||
+ * Pseudo action: FAKE6_stop_0
|
||||
+ * Pseudo action: FAKE6-clone_stopped_0
|
||||
+ * Pseudo action: FAKE6-clone_start_0
|
||||
* Resource action: lamaVM2 start on lama3
|
||||
* Resource action: lamaVM2 monitor=30000 on lama3
|
||||
* Resource action: FSlun3 monitor=10000 on lamaVM2
|
||||
diff --git a/pengine/test10/whitebox-fail1.dot b/pengine/test10/whitebox-fail1.dot
|
||||
index b595015..0f0fe26 100644
|
||||
--- a/pengine/test10/whitebox-fail1.dot
|
||||
+++ b/pengine/test10/whitebox-fail1.dot
|
||||
@@ -26,6 +26,7 @@ digraph "g" {
|
||||
"container1_start_0 18node2" -> "lxc1_start_0 18node2" [ style = bold]
|
||||
"container1_start_0 18node2" [ style=bold color="green" fontcolor="black"]
|
||||
"container1_stop_0 18node2" -> "B_stop_0 lxc1" [ style = bold]
|
||||
+"container1_stop_0 18node2" -> "M-clone_stop_0" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "M_stop_0 lxc1" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "all_stopped" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "container1_start_0 18node2" [ style = bold]
|
||||
diff --git a/pengine/test10/whitebox-fail1.exp b/pengine/test10/whitebox-fail1.exp
|
||||
index 834b231..01bb142 100644
|
||||
--- a/pengine/test10/whitebox-fail1.exp
|
||||
+++ b/pengine/test10/whitebox-fail1.exp
|
||||
@@ -96,7 +96,11 @@
|
||||
<attributes CRM_meta_clone_max="5" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
|
||||
</pseudo_event>
|
||||
</action_set>
|
||||
- <inputs/>
|
||||
+ <inputs>
|
||||
+ <trigger>
|
||||
+ <rsc_op id="5" operation="stop" operation_key="container1_stop_0" on_node="18node2" on_node_uuid="2"/>
|
||||
+ </trigger>
|
||||
+ </inputs>
|
||||
</synapse>
|
||||
<synapse id="7" priority="1000000">
|
||||
<action_set>
|
||||
diff --git a/pengine/test10/whitebox-fail1.summary b/pengine/test10/whitebox-fail1.summary
|
||||
index 5e5887b..1586407 100644
|
||||
--- a/pengine/test10/whitebox-fail1.summary
|
||||
+++ b/pengine/test10/whitebox-fail1.summary
|
||||
@@ -20,17 +20,17 @@ Transition Summary:
|
||||
* Restart lxc1 (Started 18node2)
|
||||
|
||||
Executing cluster transition:
|
||||
- * Pseudo action: M-clone_stop_0
|
||||
* Resource action: lxc1 stop on 18node2
|
||||
* Resource action: container1 stop on 18node2
|
||||
+ * Pseudo action: M-clone_stop_0
|
||||
+ * Pseudo action: B_stop_0
|
||||
+ * Resource action: container1 start on 18node2
|
||||
* Pseudo action: M_stop_0
|
||||
* Pseudo action: M-clone_stopped_0
|
||||
* Pseudo action: M-clone_start_0
|
||||
- * Pseudo action: B_stop_0
|
||||
- * Pseudo action: all_stopped
|
||||
- * Resource action: container1 start on 18node2
|
||||
* Resource action: lxc1 start on 18node2
|
||||
* Resource action: lxc1 monitor=30000 on 18node2
|
||||
+ * Pseudo action: all_stopped
|
||||
* Resource action: M start on lxc1
|
||||
* Pseudo action: M-clone_running_0
|
||||
* Resource action: B start on lxc1
|
||||
diff --git a/pengine/test10/whitebox-fail2.dot b/pengine/test10/whitebox-fail2.dot
|
||||
index b595015..0f0fe26 100644
|
||||
--- a/pengine/test10/whitebox-fail2.dot
|
||||
+++ b/pengine/test10/whitebox-fail2.dot
|
||||
@@ -26,6 +26,7 @@ digraph "g" {
|
||||
"container1_start_0 18node2" -> "lxc1_start_0 18node2" [ style = bold]
|
||||
"container1_start_0 18node2" [ style=bold color="green" fontcolor="black"]
|
||||
"container1_stop_0 18node2" -> "B_stop_0 lxc1" [ style = bold]
|
||||
+"container1_stop_0 18node2" -> "M-clone_stop_0" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "M_stop_0 lxc1" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "all_stopped" [ style = bold]
|
||||
"container1_stop_0 18node2" -> "container1_start_0 18node2" [ style = bold]
|
||||
diff --git a/pengine/test10/whitebox-fail2.exp b/pengine/test10/whitebox-fail2.exp
|
||||
index 834b231..01bb142 100644
|
||||
--- a/pengine/test10/whitebox-fail2.exp
|
||||
+++ b/pengine/test10/whitebox-fail2.exp
|
||||
@@ -96,7 +96,11 @@
|
||||
<attributes CRM_meta_clone_max="5" CRM_meta_clone_node_max="1" CRM_meta_globally_unique="false" CRM_meta_notify="false" CRM_meta_timeout="20000" />
|
||||
</pseudo_event>
|
||||
</action_set>
|
||||
- <inputs/>
|
||||
+ <inputs>
|
||||
+ <trigger>
|
||||
+ <rsc_op id="5" operation="stop" operation_key="container1_stop_0" on_node="18node2" on_node_uuid="2"/>
|
||||
+ </trigger>
|
||||
+ </inputs>
|
||||
</synapse>
|
||||
<synapse id="7" priority="1000000">
|
||||
<action_set>
|
||||
diff --git a/pengine/test10/whitebox-fail2.summary b/pengine/test10/whitebox-fail2.summary
|
||||
index 338173d..ab40d99 100644
|
||||
--- a/pengine/test10/whitebox-fail2.summary
|
||||
+++ b/pengine/test10/whitebox-fail2.summary
|
||||
@@ -20,17 +20,17 @@ Transition Summary:
|
||||
* Recover lxc1 (Started 18node2)
|
||||
|
||||
Executing cluster transition:
|
||||
- * Pseudo action: M-clone_stop_0
|
||||
* Resource action: lxc1 stop on 18node2
|
||||
* Resource action: container1 stop on 18node2
|
||||
+ * Pseudo action: M-clone_stop_0
|
||||
+ * Pseudo action: B_stop_0
|
||||
+ * Resource action: container1 start on 18node2
|
||||
* Pseudo action: M_stop_0
|
||||
* Pseudo action: M-clone_stopped_0
|
||||
* Pseudo action: M-clone_start_0
|
||||
- * Pseudo action: B_stop_0
|
||||
- * Pseudo action: all_stopped
|
||||
- * Resource action: container1 start on 18node2
|
||||
* Resource action: lxc1 start on 18node2
|
||||
* Resource action: lxc1 monitor=30000 on 18node2
|
||||
+ * Pseudo action: all_stopped
|
||||
* Resource action: M start on lxc1
|
||||
* Pseudo action: M-clone_running_0
|
||||
* Resource action: B start on lxc1
|
@ -0,0 +1,21 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 18 Aug 2015 11:06:13 +1000
|
||||
Subject: [PATCH] Fix: Date: Correctly set time from seconds-since-epoch
|
||||
|
||||
(cherry picked from commit efa318114d0b2124cc82fe143403e6de502e0134)
|
||||
---
|
||||
lib/common/iso8601.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/common/iso8601.c b/lib/common/iso8601.c
|
||||
index 769e01b..5f4a73d 100644
|
||||
--- a/lib/common/iso8601.c
|
||||
+++ b/lib/common/iso8601.c
|
||||
@@ -1011,6 +1011,7 @@ ha_set_tm_time(crm_time_t * target, struct tm *source)
|
||||
target->days = 1 + source->tm_yday;
|
||||
}
|
||||
|
||||
+ target->seconds = 0;
|
||||
if (source->tm_hour >= 0) {
|
||||
target->seconds += 60 * 60 * source->tm_hour;
|
||||
}
|
1419
0007-Test-PE-Bug-cl-5247-Imply-resources-running-on-a-con.patch
Normal file
1419
0007-Test-PE-Bug-cl-5247-Imply-resources-running-on-a-con.patch
Normal file
File diff suppressed because it is too large
Load Diff
33
0008-Fix-tools-memory-leak-in-crm_resource.patch
Normal file
33
0008-Fix-tools-memory-leak-in-crm_resource.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Mon, 17 Aug 2015 10:28:19 -0500
|
||||
Subject: [PATCH] Fix: tools: memory leak in crm_resource
|
||||
|
||||
(cherry picked from commit c11bc4b856b07d5ea5b8284a3d566dd782e6bb7c)
|
||||
---
|
||||
tools/crm_resource_runtime.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index f260e19..b9427bc 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -399,9 +399,11 @@ cli_resource_delete_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
&local_attr_id);
|
||||
|
||||
if (rc == -ENXIO) {
|
||||
+ free(lookup_id);
|
||||
return pcmk_ok;
|
||||
|
||||
} else if (rc != pcmk_ok) {
|
||||
+ free(lookup_id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -424,6 +426,7 @@ cli_resource_delete_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
attr_name ? " name=" : "", attr_name ? attr_name : "");
|
||||
}
|
||||
|
||||
+ free(lookup_id);
|
||||
free_xml(xml_obj);
|
||||
free(local_attr_id);
|
||||
return rc;
|
@ -0,0 +1,31 @@
|
||||
From: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
|
||||
Date: Fri, 21 Aug 2015 14:12:33 +0900
|
||||
Subject: [PATCH] Fix: pengine: The failed action of the resource that occurred
|
||||
in shutdown is not displayed.
|
||||
|
||||
It is like the problem that entered when you summarized an old judgment
|
||||
in function (record_failed_op) by the next correction.
|
||||
|
||||
*
|
||||
https://github.com/ClusterLabs/pacemaker/commit/9cd666ac15a2998f4543e1dac33edea36bbcf930#diff-7dae505817fa61e544018e581ee45933
|
||||
|
||||
(cherry picked from commit 119df5c0bd8fac02bd36e45a28288dcf4624b89d)
|
||||
---
|
||||
lib/pengine/unpack.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
|
||||
index 0f83be4..156a192 100644
|
||||
--- a/lib/pengine/unpack.c
|
||||
+++ b/lib/pengine/unpack.c
|
||||
@@ -2546,9 +2546,7 @@ record_failed_op(xmlNode *op, node_t* node, pe_working_set_t * data_set)
|
||||
xmlNode *xIter = NULL;
|
||||
const char *op_key = crm_element_value(op, XML_LRM_ATTR_TASK_KEY);
|
||||
|
||||
- if (node->details->shutdown) {
|
||||
- return;
|
||||
- } else if(node->details->online == FALSE) {
|
||||
+ if ((node->details->shutdown) && (node->details->online == FALSE)) {
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
From: "Gao,Yan" <ygao@suse.com>
|
||||
Date: Wed, 26 Aug 2015 18:12:56 +0200
|
||||
Subject: [PATCH] Log: services: Reduce severity of noisy log messages
|
||||
|
||||
They occurred for every monitor operation of systemd resources.
|
||||
|
||||
(cherry picked from commit a77c401a3fcdedec165c05d27a75d75abcebf4a1)
|
||||
---
|
||||
lib/services/services.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/services/services.c b/lib/services/services.c
|
||||
index 3f40078..abf1458 100644
|
||||
--- a/lib/services/services.c
|
||||
+++ b/lib/services/services.c
|
||||
@@ -366,15 +366,15 @@ services_set_op_pending(svc_action_t *op, DBusPendingCall *pending)
|
||||
if (pending) {
|
||||
crm_info("Lost pending %s DBus call (%p)", op->id, op->opaque->pending);
|
||||
} else {
|
||||
- crm_info("Done with pending %s DBus call (%p)", op->id, op->opaque->pending);
|
||||
+ crm_trace("Done with pending %s DBus call (%p)", op->id, op->opaque->pending);
|
||||
}
|
||||
dbus_pending_call_unref(op->opaque->pending);
|
||||
}
|
||||
op->opaque->pending = pending;
|
||||
if (pending) {
|
||||
- crm_info("Updated pending %s DBus call (%p)", op->id, pending);
|
||||
+ crm_trace("Updated pending %s DBus call (%p)", op->id, pending);
|
||||
} else {
|
||||
- crm_info("Cleared pending %s DBus call", op->id);
|
||||
+ crm_trace("Cleared pending %s DBus call", op->id);
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,24 @@
|
||||
From: "Gao,Yan" <ygao@suse.com>
|
||||
Date: Wed, 26 Aug 2015 16:28:38 +0200
|
||||
Subject: [PATCH] Fix: xml: Mark xml nodes as dirty if any children move
|
||||
|
||||
Otherwise if nothing else changed in the new xml, even the versions
|
||||
weren't bumped, crm_diff would output an empty xml diff.
|
||||
|
||||
(cherry picked from commit 1073786ec24f3bbf26a0f6a5b0614a65edac4301)
|
||||
---
|
||||
lib/common/xml.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/common/xml.c b/lib/common/xml.c
|
||||
index 299c7bf..353eb4b 100644
|
||||
--- a/lib/common/xml.c
|
||||
+++ b/lib/common/xml.c
|
||||
@@ -4275,6 +4275,7 @@ __xml_diff_object(xmlNode * old, xmlNode * new)
|
||||
if(p_old != p_new) {
|
||||
crm_info("%s.%s moved from %d to %d - %d",
|
||||
new_child->name, ID(new_child), p_old, p_new);
|
||||
+ __xml_node_dirty(new);
|
||||
p->flags |= xpf_moved;
|
||||
|
||||
if(p_old > p_new) {
|
565
0012-Feature-crmd-Implement-reliable-event-notifications.patch
Normal file
565
0012-Feature-crmd-Implement-reliable-event-notifications.patch
Normal file
@ -0,0 +1,565 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 1 Sep 2015 13:17:45 +1000
|
||||
Subject: [PATCH] Feature: crmd: Implement reliable event notifications
|
||||
|
||||
(cherry picked from commit 0cd1b8f02b403976afe106e0ca3a8a8a16864c6c)
|
||||
---
|
||||
crmd/Makefile.am | 2 +-
|
||||
crmd/callbacks.c | 4 +
|
||||
crmd/control.c | 67 +++++++++++++---
|
||||
crmd/crmd_utils.h | 1 +
|
||||
crmd/lrm.c | 2 +
|
||||
crmd/notify.c | 188 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
crmd/notify.h | 30 +++++++
|
||||
crmd/te_utils.c | 2 +
|
||||
cts/CIB.py | 2 +
|
||||
extra/pcmk_notify_sample.sh | 68 ++++++++++++++++
|
||||
include/crm_internal.h | 1 +
|
||||
lib/common/utils.c | 27 +++++++
|
||||
12 files changed, 380 insertions(+), 14 deletions(-)
|
||||
create mode 100644 crmd/notify.c
|
||||
create mode 100644 crmd/notify.h
|
||||
create mode 100755 extra/pcmk_notify_sample.sh
|
||||
|
||||
diff --git a/crmd/Makefile.am b/crmd/Makefile.am
|
||||
index 8e5e1df..984f5d0 100644
|
||||
--- a/crmd/Makefile.am
|
||||
+++ b/crmd/Makefile.am
|
||||
@@ -28,7 +28,7 @@ noinst_HEADERS = crmd.h crmd_fsa.h crmd_messages.h fsa_defines.h \
|
||||
fsa_matrix.h fsa_proto.h crmd_utils.h crmd_callbacks.h \
|
||||
crmd_lrm.h te_callbacks.h tengine.h
|
||||
|
||||
-crmd_SOURCES = main.c crmd.c corosync.c \
|
||||
+crmd_SOURCES = main.c crmd.c corosync.c notify.c \
|
||||
fsa.c control.c messages.c membership.c callbacks.c \
|
||||
election.c join_client.c join_dc.c subsystems.c throttle.c \
|
||||
cib.c pengine.c tengine.c lrm.c lrm_state.c remote_lrmd_ra.c \
|
||||
diff --git a/crmd/callbacks.c b/crmd/callbacks.c
|
||||
index f646927..38fb30b 100644
|
||||
--- a/crmd/callbacks.c
|
||||
+++ b/crmd/callbacks.c
|
||||
@@ -126,6 +126,7 @@ peer_update_callback(enum crm_status_type type, crm_node_t * node, const void *d
|
||||
case crm_status_nstate:
|
||||
crm_info("%s is now %s (was %s)",
|
||||
node->uname, state_text(node->state), state_text(data));
|
||||
+
|
||||
if (safe_str_eq(data, node->state)) {
|
||||
/* State did not change */
|
||||
return;
|
||||
@@ -147,7 +148,10 @@ peer_update_callback(enum crm_status_type type, crm_node_t * node, const void *d
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ crmd_notify_node_event(node);
|
||||
break;
|
||||
+
|
||||
case crm_status_processes:
|
||||
if (data) {
|
||||
old = *(const uint32_t *)data;
|
||||
diff --git a/crmd/control.c b/crmd/control.c
|
||||
index f4add49..d92f46b 100644
|
||||
--- a/crmd/control.c
|
||||
+++ b/crmd/control.c
|
||||
@@ -873,28 +873,64 @@ do_recover(long long action,
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
pe_cluster_option crmd_opts[] = {
|
||||
- /* name, old-name, validate, default, description */
|
||||
- { "dc-version", NULL, "string", NULL, "none", NULL, "Version of Pacemaker on the cluster's DC.", "Includes the hash which identifies the exact Mercurial changeset it was built from. Used for diagnostic purposes." },
|
||||
- { "cluster-infrastructure", NULL, "string", NULL, "heartbeat", NULL, "The messaging stack on which Pacemaker is currently running.", "Used for informational and diagnostic purposes." },
|
||||
- { XML_CONFIG_ATTR_DC_DEADTIME, "dc_deadtime", "time", NULL, "20s", &check_time, "How long to wait for a response from other nodes during startup.", "The \"correct\" value will depend on the speed/load of your network and the type of switches used." },
|
||||
+ /* name, old-name, validate, values, default, short description, long description */
|
||||
+ { "dc-version", NULL, "string", NULL, "none", NULL,
|
||||
+ "Version of Pacemaker on the cluster's DC.",
|
||||
+ "Includes the hash which identifies the exact changeset it was built from. Used for diagnostic purposes."
|
||||
+ },
|
||||
+ { "cluster-infrastructure", NULL, "string", NULL, "heartbeat", NULL,
|
||||
+ "The messaging stack on which Pacemaker is currently running.",
|
||||
+ "Used for informational and diagnostic purposes." },
|
||||
+ { XML_CONFIG_ATTR_DC_DEADTIME, "dc_deadtime", "time", NULL, "20s", &check_time,
|
||||
+ "How long to wait for a response from other nodes during startup.",
|
||||
+ "The \"correct\" value will depend on the speed/load of your network and the type of switches used."
|
||||
+ },
|
||||
{ XML_CONFIG_ATTR_RECHECK, "cluster_recheck_interval", "time",
|
||||
- "Zero disables polling. Positive values are an interval in seconds (unless other SI units are specified. eg. 5min)", "15min", &check_timer,
|
||||
+ "Zero disables polling. Positive values are an interval in seconds (unless other SI units are specified. eg. 5min)",
|
||||
+ "15min", &check_timer,
|
||||
"Polling interval for time based changes to options, resource parameters and constraints.",
|
||||
"The Cluster is primarily event driven, however the configuration can have elements that change based on time."
|
||||
- " To ensure these changes take effect, we can optionally poll the cluster's status for changes." },
|
||||
+ " To ensure these changes take effect, we can optionally poll the cluster's status for changes."
|
||||
+ },
|
||||
+
|
||||
+ { "notification-script", NULL, "string", NULL, "/dev/null", &check_script,
|
||||
+ "Notification script to be called after significant cluster events",
|
||||
+ "Full path to a script that will be invoked when resources start/stop/fail, fencing occurs or nodes join/leave the cluster.\n"
|
||||
+ "Must exist on all nodes in the cluster."
|
||||
+ },
|
||||
+ { "notification-target", NULL, "string", NULL, "", NULL,
|
||||
+ "Destination for notifications (Optional)",
|
||||
+ "Where should the supplied script send notifications to. Useful to avoid hard-coding this in the script."
|
||||
+ },
|
||||
+
|
||||
{ "load-threshold", NULL, "percentage", NULL, "80%", &check_utilization,
|
||||
"The maximum amount of system resources that should be used by nodes in the cluster",
|
||||
"The cluster will slow down its recovery process when the amount of system resources used"
|
||||
- " (currently CPU) approaches this limit", },
|
||||
+ " (currently CPU) approaches this limit",
|
||||
+ },
|
||||
{ "node-action-limit", NULL, "integer", NULL, "0", &check_number,
|
||||
"The maximum number of jobs that can be scheduled per node. Defaults to 2x cores"},
|
||||
- { XML_CONFIG_ATTR_ELECTION_FAIL, "election_timeout", "time", NULL, "2min", &check_timer, "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug." },
|
||||
- { XML_CONFIG_ATTR_FORCE_QUIT, "shutdown_escalation", "time", NULL, "20min", &check_timer, "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug." },
|
||||
- { "crmd-integration-timeout", NULL, "time", NULL, "3min", &check_timer, "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug." },
|
||||
- { "crmd-finalization-timeout", NULL, "time", NULL, "30min", &check_timer, "*** Advanced Use Only ***.", "If you need to adjust this value, it probably indicates the presence of a bug." },
|
||||
- { "crmd-transition-delay", NULL, "time", NULL, "0s", &check_timer, "*** Advanced Use Only ***\nEnabling this option will slow down cluster recovery under all conditions", "Delay cluster recovery for the configured interval to allow for additional/related events to occur.\nUseful if your configuration is sensitive to the order in which ping updates arrive." },
|
||||
+ { XML_CONFIG_ATTR_ELECTION_FAIL, "election_timeout", "time", NULL, "2min", &check_timer,
|
||||
+ "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug."
|
||||
+ },
|
||||
+ { XML_CONFIG_ATTR_FORCE_QUIT, "shutdown_escalation", "time", NULL, "20min", &check_timer,
|
||||
+ "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug."
|
||||
+ },
|
||||
+ { "crmd-integration-timeout", NULL, "time", NULL, "3min", &check_timer,
|
||||
+ "*** Advanced Use Only ***.", "If need to adjust this value, it probably indicates the presence of a bug."
|
||||
+ },
|
||||
+ { "crmd-finalization-timeout", NULL, "time", NULL, "30min", &check_timer,
|
||||
+ "*** Advanced Use Only ***.", "If you need to adjust this value, it probably indicates the presence of a bug."
|
||||
+ },
|
||||
+ { "crmd-transition-delay", NULL, "time", NULL, "0s", &check_timer,
|
||||
+ "*** Advanced Use Only ***\n"
|
||||
+ "Enabling this option will slow down cluster recovery under all conditions",
|
||||
+ "Delay cluster recovery for the configured interval to allow for additional/related events to occur.\n"
|
||||
+ "Useful if your configuration is sensitive to the order in which ping updates arrive."
|
||||
+ },
|
||||
{ "stonith-watchdog-timeout", NULL, "time", NULL, NULL, &check_timer,
|
||||
- "How long to wait before we can assume nodes are safely down", NULL },
|
||||
+ "How long to wait before we can assume nodes are safely down", NULL
|
||||
+ },
|
||||
{ "no-quorum-policy", "no_quorum_policy", "enum", "stop, freeze, ignore, suicide", "stop", &check_quorum, NULL, NULL },
|
||||
|
||||
#if SUPPORT_PLUGIN
|
||||
@@ -927,6 +963,7 @@ crmd_pref(GHashTable * options, const char *name)
|
||||
static void
|
||||
config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data)
|
||||
{
|
||||
+ const char *script = NULL;
|
||||
const char *value = NULL;
|
||||
GHashTable *config_hash = NULL;
|
||||
crm_time_t *now = crm_time_new(NULL);
|
||||
@@ -955,6 +992,10 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
|
||||
|
||||
verify_crmd_options(config_hash);
|
||||
|
||||
+ script = crmd_pref(config_hash, "notification-script");
|
||||
+ value = crmd_pref(config_hash, "notification-target");
|
||||
+ crmd_enable_notifications(script, value);
|
||||
+
|
||||
value = crmd_pref(config_hash, XML_CONFIG_ATTR_DC_DEADTIME);
|
||||
election_trigger->period_ms = crm_get_msec(value);
|
||||
|
||||
diff --git a/crmd/crmd_utils.h b/crmd/crmd_utils.h
|
||||
index 78214bf..7e8c3e6 100644
|
||||
--- a/crmd/crmd_utils.h
|
||||
+++ b/crmd/crmd_utils.h
|
||||
@@ -21,6 +21,7 @@
|
||||
# include <crm/crm.h>
|
||||
# include <crm/common/xml.h>
|
||||
# include <crm/cib/internal.h> /* For CIB_OP_MODIFY */
|
||||
+# include "notify.h"
|
||||
|
||||
# define CLIENT_EXIT_WAIT 30
|
||||
# define FAKE_TE_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
||||
diff --git a/crmd/lrm.c b/crmd/lrm.c
|
||||
index 418e7cf..48195e8 100644
|
||||
--- a/crmd/lrm.c
|
||||
+++ b/crmd/lrm.c
|
||||
@@ -2415,6 +2415,8 @@ process_lrm_event(lrm_state_t * lrm_state, lrmd_event_data_t * op, struct recurr
|
||||
free(prefix);
|
||||
}
|
||||
|
||||
+ crmd_notify_resource_op(lrm_state->node_name, op);
|
||||
+
|
||||
if (op->rsc_deleted) {
|
||||
crm_info("Deletion of resource '%s' complete after %s", op->rsc_id, op_key);
|
||||
delete_rsc_entry(lrm_state, NULL, op->rsc_id, NULL, pcmk_ok, NULL);
|
||||
diff --git a/crmd/notify.c b/crmd/notify.c
|
||||
new file mode 100644
|
||||
index 0000000..980bfa6
|
||||
--- /dev/null
|
||||
+++ b/crmd/notify.c
|
||||
@@ -0,0 +1,188 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2015 Andrew Beekhof <andrew@beekhof.net>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#include <crm_internal.h>
|
||||
+#include <crm/crm.h>
|
||||
+#include <crm/msg_xml.h>
|
||||
+#include "notify.h"
|
||||
+
|
||||
+char *notify_script = NULL;
|
||||
+char *notify_target = NULL;
|
||||
+
|
||||
+
|
||||
+static const char *notify_keys[] =
|
||||
+{
|
||||
+ "CRM_notify_recipient",
|
||||
+ "CRM_notify_node",
|
||||
+ "CRM_notify_rsc",
|
||||
+ "CRM_notify_task",
|
||||
+ "CRM_notify_interval",
|
||||
+ "CRM_notify_desc",
|
||||
+ "CRM_notify_status",
|
||||
+ "CRM_notify_target_rc",
|
||||
+ "CRM_notify_rc",
|
||||
+ "CRM_notify_kind",
|
||||
+ "CRM_notify_version",
|
||||
+};
|
||||
+
|
||||
+
|
||||
+void
|
||||
+crmd_enable_notifications(const char *script, const char *target)
|
||||
+{
|
||||
+ free(notify_script);
|
||||
+ notify_script = NULL;
|
||||
+
|
||||
+ free(notify_target);
|
||||
+ notify_target = NULL;
|
||||
+
|
||||
+ if(safe_str_eq(script, "/dev/null")) {
|
||||
+ crm_notice("Notifications disabled");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ notify_script = strdup(script);
|
||||
+ notify_target = strdup(target);
|
||||
+ crm_notice("Notifications enabled");
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+set_notify_key(const char *name, const char *cvalue, char *value)
|
||||
+{
|
||||
+ int lpc;
|
||||
+ bool found = 0;
|
||||
+
|
||||
+ if(cvalue == NULL) {
|
||||
+ cvalue = value;
|
||||
+ }
|
||||
+
|
||||
+ for(lpc = 0; lpc < DIMOF(notify_keys); lpc++) {
|
||||
+ if(safe_str_eq(name, notify_keys[lpc])) {
|
||||
+ found = 1;
|
||||
+ crm_trace("Setting notify key %s = '%s'", name, cvalue);
|
||||
+ setenv(name, cvalue, 1);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CRM_ASSERT(found != 0);
|
||||
+ free(value);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+send_notification(const char *kind)
|
||||
+{
|
||||
+ int lpc;
|
||||
+ pid_t pid;
|
||||
+
|
||||
+ crm_debug("Sending '%s' notification to '%s' via '%s'", kind, notify_target, notify_script);
|
||||
+
|
||||
+ set_notify_key("CRM_notify_recipient", notify_target, NULL);
|
||||
+ set_notify_key("CRM_notify_kind", kind, NULL);
|
||||
+ set_notify_key("CRM_notify_version", VERSION, NULL);
|
||||
+
|
||||
+ pid = fork();
|
||||
+ if (pid == -1) {
|
||||
+ crm_perror(LOG_ERR, "notification failed");
|
||||
+ }
|
||||
+
|
||||
+ if (pid == 0) {
|
||||
+ /* crm_debug("notification: I am the child. Executing the nofitication program."); */
|
||||
+ execl(notify_script, notify_script, NULL);
|
||||
+ exit(EXIT_FAILURE);
|
||||
+
|
||||
+ } else {
|
||||
+ for(lpc = 0; lpc < DIMOF(notify_keys); lpc++) {
|
||||
+ unsetenv(notify_keys[lpc]);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void crmd_notify_node_event(crm_node_t *node)
|
||||
+{
|
||||
+ if(notify_script == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ set_notify_key("CRM_notify_node", node->uname, NULL);
|
||||
+ set_notify_key("CRM_notify_desc", node->state, NULL);
|
||||
+
|
||||
+ send_notification("node");
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+crmd_notify_fencing_op(stonith_event_t * e)
|
||||
+{
|
||||
+ char *desc = NULL;
|
||||
+
|
||||
+ if(notify_script) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ desc = crm_strdup_printf("Operation %s requested by %s for peer %s: %s (ref=%s)",
|
||||
+ e->operation, e->origin, e->target, pcmk_strerror(e->result),
|
||||
+ e->id);
|
||||
+
|
||||
+ set_notify_key("CRM_notify_node", e->target, NULL);
|
||||
+ set_notify_key("CRM_notify_task", e->operation, NULL);
|
||||
+ set_notify_key("CRM_notify_desc", NULL, desc);
|
||||
+ set_notify_key("CRM_notify_rc", NULL, crm_itoa(e->result));
|
||||
+
|
||||
+ send_notification("fencing");
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+crmd_notify_resource_op(const char *node, lrmd_event_data_t * op)
|
||||
+{
|
||||
+ int target_rc = 0;
|
||||
+
|
||||
+ if(notify_script == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ target_rc = rsc_op_expected_rc(op);
|
||||
+ if(op->interval == 0 && target_rc == op->rc && safe_str_eq(op->op_type, RSC_STATUS)) {
|
||||
+ /* Leave it up to the script if they want to notify for
|
||||
+ * 'failed' probes, only swallow ones for which the result was
|
||||
+ * unexpected.
|
||||
+ *
|
||||
+ * Even if we find a resource running, it was probably because
|
||||
+ * someone erased the status section.
|
||||
+ */
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ set_notify_key("CRM_notify_node", node, NULL);
|
||||
+
|
||||
+ set_notify_key("CRM_notify_rsc", op->rsc_id, NULL);
|
||||
+ set_notify_key("CRM_notify_task", op->op_type, NULL);
|
||||
+ set_notify_key("CRM_notify_interval", NULL, crm_itoa(op->interval));
|
||||
+
|
||||
+ set_notify_key("CRM_notify_target_rc", NULL, crm_itoa(target_rc));
|
||||
+ set_notify_key("CRM_notify_status", NULL, crm_itoa(op->op_status));
|
||||
+ set_notify_key("CRM_notify_rc", NULL, crm_itoa(op->rc));
|
||||
+
|
||||
+ if(op->op_status == PCMK_LRM_OP_DONE) {
|
||||
+ set_notify_key("CRM_notify_desc", services_ocf_exitcode_str(op->rc), NULL);
|
||||
+ } else {
|
||||
+ set_notify_key("CRM_notify_desc", services_lrm_status_str(op->op_status), NULL);
|
||||
+ }
|
||||
+
|
||||
+ send_notification("resource");
|
||||
+}
|
||||
+
|
||||
diff --git a/crmd/notify.h b/crmd/notify.h
|
||||
new file mode 100644
|
||||
index 0000000..4b138ea
|
||||
--- /dev/null
|
||||
+++ b/crmd/notify.h
|
||||
@@ -0,0 +1,30 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2015 Andrew Beekhof <andrew@beekhof.net>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This software is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+#ifndef CRMD_NOTIFY__H
|
||||
+# define CRMD_NOTIFY__H
|
||||
+
|
||||
+# include <crm/crm.h>
|
||||
+# include <crm/cluster.h>
|
||||
+# include <crm/stonith-ng.h>
|
||||
+
|
||||
+void crmd_enable_notifications(const char *script, const char *target);
|
||||
+void crmd_notify_node_event(crm_node_t *node);
|
||||
+void crmd_notify_fencing_op(stonith_event_t * e);
|
||||
+void crmd_notify_resource_op(const char *node, lrmd_event_data_t * op);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/crmd/te_utils.c b/crmd/te_utils.c
|
||||
index a1d29f6..22551ba 100644
|
||||
--- a/crmd/te_utils.c
|
||||
+++ b/crmd/te_utils.c
|
||||
@@ -124,6 +124,8 @@ tengine_stonith_notify(stonith_t * st, stonith_event_t * st_event)
|
||||
return;
|
||||
}
|
||||
|
||||
+ crmd_notify_fencing_op(st_event);
|
||||
+
|
||||
if (st_event->result == pcmk_ok && safe_str_eq("on", st_event->action)) {
|
||||
crm_notice("%s was successfully unfenced by %s (at the request of %s)",
|
||||
st_event->target, st_event->executioner ? st_event->executioner : "<anyone>", st_event->origin);
|
||||
diff --git a/cts/CIB.py b/cts/CIB.py
|
||||
index 8fbba6c..cd3a6a1 100644
|
||||
--- a/cts/CIB.py
|
||||
+++ b/cts/CIB.py
|
||||
@@ -219,6 +219,8 @@ class CIB11(ConfigBase):
|
||||
o["dc-deadtime"] = "5s"
|
||||
o["no-quorum-policy"] = no_quorum
|
||||
o["expected-quorum-votes"] = self.num_nodes
|
||||
+ o["notification-script"] = "/var/lib/pacemaker/notify.sh"
|
||||
+ o["notification-target"] = "/var/lib/pacemaker/notify.log"
|
||||
|
||||
if self.CM.Env["DoBSC"] == 1:
|
||||
o["ident-string"] = "Linux-HA TEST configuration file - REMOVEME!!"
|
||||
diff --git a/extra/pcmk_notify_sample.sh b/extra/pcmk_notify_sample.sh
|
||||
new file mode 100755
|
||||
index 0000000..83cf8e9
|
||||
--- /dev/null
|
||||
+++ b/extra/pcmk_notify_sample.sh
|
||||
@@ -0,0 +1,68 @@
|
||||
+#!/bin/bash
|
||||
+#
|
||||
+# Copyright (C) 2015 Andrew Beekhof <andrew@beekhof.net>
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or
|
||||
+# modify it under the terms of the GNU General Public
|
||||
+# License as published by the Free Software Foundation; either
|
||||
+# version 2 of the License, or (at your option) any later version.
|
||||
+#
|
||||
+# This software is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+# General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public
|
||||
+# License along with this library; if not, write to the Free Software
|
||||
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+
|
||||
+if [ -z $CRM_notify_version ]; then
|
||||
+ echo "Pacemaker version 1.1.14 is required" >> ${CRM_notify_recipient}
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+case $CRM_notify_kind in
|
||||
+ node)
|
||||
+ echo "Node '${CRM_notify_node}' is now '${CRM_notify_desc}'" >> ${CRM_notify_recipient}
|
||||
+ ;;
|
||||
+ fencing)
|
||||
+ # Other keys:
|
||||
+ #
|
||||
+ # CRM_notify_node
|
||||
+ # CRM_notify_task
|
||||
+ # CRM_notify_rc
|
||||
+ #
|
||||
+ echo "Fencing ${CRM_notify_desc}" >> ${CRM_notify_recipient}
|
||||
+ ;;
|
||||
+ resource)
|
||||
+ # Other keys:
|
||||
+ #
|
||||
+ # CRM_notify_target_rc
|
||||
+ # CRM_notify_status
|
||||
+ # CRM_notify_rc
|
||||
+ #
|
||||
+ if [ ${CRM_notify_interval} = "0" ]; then
|
||||
+ CRM_notify_interval=""
|
||||
+ else
|
||||
+ CRM_notify_interval=" (${CRM_notify_interval})"
|
||||
+ fi
|
||||
+
|
||||
+ if [ ${CRM_notify_target_rc} = "0" ]; then
|
||||
+ CRM_notify_target_rc=""
|
||||
+ else
|
||||
+ CRM_notify_target_rc=" (target: ${CRM_notify_target_rc})"
|
||||
+ fi
|
||||
+
|
||||
+ case ${CRM_notify_desc} in
|
||||
+ Cancelled) ;;
|
||||
+ *)
|
||||
+ echo "Resource operation '${CRM_notify_task}${CRM_notify_interval}' for '${CRM_notify_rsc}' on '${CRM_notify_node}': ${CRM_notify_desc}${CRM_notify_target_rc}" >> ${CRM_notify_recipient}
|
||||
+ ;;
|
||||
+ esac
|
||||
+ ;;
|
||||
+ *)
|
||||
+ echo "Unhandled $CRM_notify_kind notification" >> ${CRM_notify_recipient}
|
||||
+ env | grep CRM_notify >> ${CRM_notify_recipient}
|
||||
+ ;;
|
||||
+
|
||||
+esac
|
||||
diff --git a/include/crm_internal.h b/include/crm_internal.h
|
||||
index c13bc7b..fb03537 100644
|
||||
--- a/include/crm_internal.h
|
||||
+++ b/include/crm_internal.h
|
||||
@@ -127,6 +127,7 @@ gboolean check_timer(const char *value);
|
||||
gboolean check_boolean(const char *value);
|
||||
gboolean check_number(const char *value);
|
||||
gboolean check_quorum(const char *value);
|
||||
+gboolean check_script(const char *value);
|
||||
gboolean check_utilization(const char *value);
|
||||
|
||||
/* Shared PE/crmd functionality */
|
||||
diff --git a/lib/common/utils.c b/lib/common/utils.c
|
||||
index 6a234dc..628cf2f 100644
|
||||
--- a/lib/common/utils.c
|
||||
+++ b/lib/common/utils.c
|
||||
@@ -180,6 +180,33 @@ check_quorum(const char *value)
|
||||
}
|
||||
|
||||
gboolean
|
||||
+check_script(const char *value)
|
||||
+{
|
||||
+ struct stat st;
|
||||
+
|
||||
+ if(safe_str_eq(value, "/dev/null")) {
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if(stat(value, &st) != 0) {
|
||||
+ crm_err("Script %s does not exist", value);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if(S_ISREG(st.st_mode) == 0) {
|
||||
+ crm_err("Script %s is not a regular file", value);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if( (st.st_mode & (S_IXUSR | S_IXGRP )) == 0) {
|
||||
+ crm_err("Script %s is not executable", value);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+gboolean
|
||||
check_utilization(const char *value)
|
||||
{
|
||||
char *end = NULL;
|
47
0013-Fix-cman-Suppress-implied-node-names.patch
Normal file
47
0013-Fix-cman-Suppress-implied-node-names.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 2 Sep 2015 12:08:52 +1000
|
||||
Subject: [PATCH] Fix: cman: Suppress implied node names
|
||||
|
||||
(cherry picked from commit e94fbcd0c49db9d3c69b7c0e478ba89a4d360dde)
|
||||
---
|
||||
tools/crm_node.c | 20 +++++++++++++++++++-
|
||||
1 file changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_node.c b/tools/crm_node.c
|
||||
index d0195e3..24cc4d7 100644
|
||||
--- a/tools/crm_node.c
|
||||
+++ b/tools/crm_node.c
|
||||
@@ -434,6 +434,21 @@ try_heartbeat(int command, enum cluster_type_e stack)
|
||||
#if SUPPORT_CMAN
|
||||
# include <libcman.h>
|
||||
# define MAX_NODES 256
|
||||
+static bool valid_cman_name(const char *name, uint32_t nodeid)
|
||||
+{
|
||||
+ bool rc = TRUE;
|
||||
+
|
||||
+ /* Yes, %d, because that's what CMAN does */
|
||||
+ char *fakename = crm_strdup_printf("Node%d", nodeid);
|
||||
+
|
||||
+ if(crm_str_eq(fakename, name, TRUE)) {
|
||||
+ rc = FALSE;
|
||||
+ crm_notice("Ignoring inferred name from cman: %s", fakename);
|
||||
+ }
|
||||
+ free(fakename);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
static gboolean
|
||||
try_cman(int command, enum cluster_type_e stack)
|
||||
{
|
||||
@@ -478,7 +493,10 @@ try_cman(int command, enum cluster_type_e stack)
|
||||
}
|
||||
|
||||
for (lpc = 0; lpc < node_count; lpc++) {
|
||||
- if (command == 'l') {
|
||||
+ if(valid_cman_name(cman_nodes[lpc].cn_name, cman_nodes[lpc].cn_nodeid) == FALSE) {
|
||||
+ /* Do not print */
|
||||
+
|
||||
+ } if (command == 'l') {
|
||||
printf("%s ", cman_nodes[lpc].cn_name);
|
||||
|
||||
} else if (cman_nodes[lpc].cn_nodeid != 0 && cman_nodes[lpc].cn_member) {
|
@ -0,0 +1,58 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 2 Sep 2015 14:32:40 +1000
|
||||
Subject: [PATCH] Fix: crmd: Choose more appropriate names for notification
|
||||
options
|
||||
|
||||
(cherry picked from commit 8971ef024ffebf3d0240b30e620697a7b58232c4)
|
||||
---
|
||||
crmd/control.c | 12 ++++++------
|
||||
cts/CIB.py | 4 ++--
|
||||
2 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/crmd/control.c b/crmd/control.c
|
||||
index d92f46b..d1f9acd 100644
|
||||
--- a/crmd/control.c
|
||||
+++ b/crmd/control.c
|
||||
@@ -893,12 +893,12 @@ pe_cluster_option crmd_opts[] = {
|
||||
" To ensure these changes take effect, we can optionally poll the cluster's status for changes."
|
||||
},
|
||||
|
||||
- { "notification-script", NULL, "string", NULL, "/dev/null", &check_script,
|
||||
- "Notification script to be called after significant cluster events",
|
||||
- "Full path to a script that will be invoked when resources start/stop/fail, fencing occurs or nodes join/leave the cluster.\n"
|
||||
+ { "notification-agent", NULL, "string", NULL, "/dev/null", &check_script,
|
||||
+ "Notification script or tool to be called after significant cluster events",
|
||||
+ "Full path to a script or binary that will be invoked when resources start/stop/fail, fencing occurs or nodes join/leave the cluster.\n"
|
||||
"Must exist on all nodes in the cluster."
|
||||
},
|
||||
- { "notification-target", NULL, "string", NULL, "", NULL,
|
||||
+ { "notification-recipient", NULL, "string", NULL, "", NULL,
|
||||
"Destination for notifications (Optional)",
|
||||
"Where should the supplied script send notifications to. Useful to avoid hard-coding this in the script."
|
||||
},
|
||||
@@ -992,8 +992,8 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
|
||||
|
||||
verify_crmd_options(config_hash);
|
||||
|
||||
- script = crmd_pref(config_hash, "notification-script");
|
||||
- value = crmd_pref(config_hash, "notification-target");
|
||||
+ script = crmd_pref(config_hash, "notification-agent");
|
||||
+ value = crmd_pref(config_hash, "notification-recipient");
|
||||
crmd_enable_notifications(script, value);
|
||||
|
||||
value = crmd_pref(config_hash, XML_CONFIG_ATTR_DC_DEADTIME);
|
||||
diff --git a/cts/CIB.py b/cts/CIB.py
|
||||
index cd3a6a1..0933ccd 100644
|
||||
--- a/cts/CIB.py
|
||||
+++ b/cts/CIB.py
|
||||
@@ -219,8 +219,8 @@ class CIB11(ConfigBase):
|
||||
o["dc-deadtime"] = "5s"
|
||||
o["no-quorum-policy"] = no_quorum
|
||||
o["expected-quorum-votes"] = self.num_nodes
|
||||
- o["notification-script"] = "/var/lib/pacemaker/notify.sh"
|
||||
- o["notification-target"] = "/var/lib/pacemaker/notify.log"
|
||||
+ o["notification-agent"] = "/var/lib/pacemaker/notify.sh"
|
||||
+ o["notification-recipient"] = "/var/lib/pacemaker/notify.log"
|
||||
|
||||
if self.CM.Env["DoBSC"] == 1:
|
||||
o["ident-string"] = "Linux-HA TEST configuration file - REMOVEME!!"
|
22
0015-Fix-crmd-Correctly-enable-disable-notifications.patch
Normal file
22
0015-Fix-crmd-Correctly-enable-disable-notifications.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 2 Sep 2015 14:48:17 +1000
|
||||
Subject: [PATCH] Fix: crmd: Correctly enable/disable notifications
|
||||
|
||||
(cherry picked from commit 7368cf120cd5ee848d2bdcd788497a3b89616b05)
|
||||
---
|
||||
crmd/notify.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/crmd/notify.c b/crmd/notify.c
|
||||
index 980bfa6..ccf5ea8 100644
|
||||
--- a/crmd/notify.c
|
||||
+++ b/crmd/notify.c
|
||||
@@ -50,7 +50,7 @@ crmd_enable_notifications(const char *script, const char *target)
|
||||
free(notify_target);
|
||||
notify_target = NULL;
|
||||
|
||||
- if(safe_str_eq(script, "/dev/null")) {
|
||||
+ if(script == NULL || safe_str_eq(script, "/dev/null")) {
|
||||
crm_notice("Notifications disabled");
|
||||
return;
|
||||
}
|
109
0016-Fix-crmd-Report-the-completion-status-and-output-of-.patch
Normal file
109
0016-Fix-crmd-Report-the-completion-status-and-output-of-.patch
Normal file
@ -0,0 +1,109 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 2 Sep 2015 14:34:04 +1000
|
||||
Subject: [PATCH] Fix: crmd: Report the completion status and output of
|
||||
notifications
|
||||
|
||||
(cherry picked from commit 0c303d8a6f9f9a9dbec9f6d2e9e799fe335f8eaa)
|
||||
---
|
||||
crmd/notify.c | 37 ++++++++++++++++++++++++-------------
|
||||
lib/services/services.c | 4 ++--
|
||||
2 files changed, 26 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/crmd/notify.c b/crmd/notify.c
|
||||
index ccf5ea8..ca2be0f 100644
|
||||
--- a/crmd/notify.c
|
||||
+++ b/crmd/notify.c
|
||||
@@ -29,6 +29,7 @@ static const char *notify_keys[] =
|
||||
{
|
||||
"CRM_notify_recipient",
|
||||
"CRM_notify_node",
|
||||
+ "CRM_notify_nodeid",
|
||||
"CRM_notify_rsc",
|
||||
"CRM_notify_task",
|
||||
"CRM_notify_interval",
|
||||
@@ -83,12 +84,21 @@ set_notify_key(const char *name, const char *cvalue, char *value)
|
||||
free(value);
|
||||
}
|
||||
|
||||
+static void crmd_notify_complete(svc_action_t *op)
|
||||
+{
|
||||
+ if(op->rc == 0) {
|
||||
+ crm_info("Notification %d (%s) complete", op->sequence, op->agent);
|
||||
+ } else {
|
||||
+ crm_warn("Notification %d (%s) failed: %d", op->sequence, op->agent, op->rc);
|
||||
+ }
|
||||
+}
|
||||
|
||||
static void
|
||||
send_notification(const char *kind)
|
||||
{
|
||||
int lpc;
|
||||
- pid_t pid;
|
||||
+ svc_action_t *notify = NULL;
|
||||
+ static int operations = 0;
|
||||
|
||||
crm_debug("Sending '%s' notification to '%s' via '%s'", kind, notify_target, notify_script);
|
||||
|
||||
@@ -96,20 +106,20 @@ send_notification(const char *kind)
|
||||
set_notify_key("CRM_notify_kind", kind, NULL);
|
||||
set_notify_key("CRM_notify_version", VERSION, NULL);
|
||||
|
||||
- pid = fork();
|
||||
- if (pid == -1) {
|
||||
- crm_perror(LOG_ERR, "notification failed");
|
||||
- }
|
||||
+ notify = services_action_create_generic(notify_script, NULL);
|
||||
|
||||
- if (pid == 0) {
|
||||
- /* crm_debug("notification: I am the child. Executing the nofitication program."); */
|
||||
- execl(notify_script, notify_script, NULL);
|
||||
- exit(EXIT_FAILURE);
|
||||
+ notify->timeout = 300;
|
||||
+ notify->standard = strdup("event");
|
||||
+ notify->id = strdup(notify_script);
|
||||
+ notify->agent = strdup(notify_script);
|
||||
+ notify->sequence = ++operations;
|
||||
|
||||
- } else {
|
||||
- for(lpc = 0; lpc < DIMOF(notify_keys); lpc++) {
|
||||
- unsetenv(notify_keys[lpc]);
|
||||
- }
|
||||
+ if(services_action_async(notify, &crmd_notify_complete) == FALSE) {
|
||||
+ services_action_free(notify);
|
||||
+ }
|
||||
+
|
||||
+ for(lpc = 0; lpc < DIMOF(notify_keys); lpc++) {
|
||||
+ unsetenv(notify_keys[lpc]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +130,7 @@ void crmd_notify_node_event(crm_node_t *node)
|
||||
}
|
||||
|
||||
set_notify_key("CRM_notify_node", node->uname, NULL);
|
||||
+ set_notify_key("CRM_notify_nodeid", NULL, crm_itoa(node->id));
|
||||
set_notify_key("CRM_notify_desc", node->state, NULL);
|
||||
|
||||
send_notification("node");
|
||||
diff --git a/lib/services/services.c b/lib/services/services.c
|
||||
index abf1458..4609a7d 100644
|
||||
--- a/lib/services/services.c
|
||||
+++ b/lib/services/services.c
|
||||
@@ -598,7 +598,7 @@ action_async_helper(svc_action_t * op) {
|
||||
}
|
||||
|
||||
/* keep track of ops that are in-flight to avoid collisions in the same namespace */
|
||||
- if (res) {
|
||||
+ if (op->rsc && res) {
|
||||
inflight_ops = g_list_append(inflight_ops, op);
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t *
|
||||
g_hash_table_replace(recurring_actions, op->id, op);
|
||||
}
|
||||
|
||||
- if (is_op_blocked(op->rsc)) {
|
||||
+ if (op->rsc && is_op_blocked(op->rsc)) {
|
||||
blocked_ops = g_list_append(blocked_ops, op);
|
||||
return TRUE;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 3 Sep 2015 10:58:59 +1000
|
||||
Subject: [PATCH] Fix: cman: Print the nodeid of nodes with fake names
|
||||
|
||||
(cherry picked from commit dd9a379408aa43b89c81d31ce7efa60b2e77f593)
|
||||
---
|
||||
tools/crm_node.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/crm_node.c b/tools/crm_node.c
|
||||
index 24cc4d7..ed02ee7 100644
|
||||
--- a/tools/crm_node.c
|
||||
+++ b/tools/crm_node.c
|
||||
@@ -494,7 +494,8 @@ try_cman(int command, enum cluster_type_e stack)
|
||||
|
||||
for (lpc = 0; lpc < node_count; lpc++) {
|
||||
if(valid_cman_name(cman_nodes[lpc].cn_name, cman_nodes[lpc].cn_nodeid) == FALSE) {
|
||||
- /* Do not print */
|
||||
+ /* The name was invented, but we need to print something, make it the id instead */
|
||||
+ printf("%u ", cman_nodes[lpc].cn_nodeid);
|
||||
|
||||
} if (command == 'l') {
|
||||
printf("%s ", cman_nodes[lpc].cn_name);
|
299
0018-Refactor-Tools-Isolate-the-paths-which-truely-requir.patch
Normal file
299
0018-Refactor-Tools-Isolate-the-paths-which-truely-requir.patch
Normal file
@ -0,0 +1,299 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 3 Sep 2015 11:36:21 +1000
|
||||
Subject: [PATCH] Refactor: Tools: Isolate the paths which truely require
|
||||
corosync-2.x
|
||||
|
||||
(cherry picked from commit 32c05b99f6a3e953668dcda71ce24e03927d83cb)
|
||||
---
|
||||
tools/crm_node.c | 243 +++++++++++++++++++++++++++++++------------------------
|
||||
1 file changed, 139 insertions(+), 104 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_node.c b/tools/crm_node.c
|
||||
index ed02ee7..308d4f9 100644
|
||||
--- a/tools/crm_node.c
|
||||
+++ b/tools/crm_node.c
|
||||
@@ -60,6 +60,9 @@ static struct crm_option long_options[] = {
|
||||
#if SUPPORT_COROSYNC
|
||||
{"openais", 0, 0, 'A', "\tOnly try connecting to an OpenAIS-based cluster"},
|
||||
#endif
|
||||
+#ifdef SUPPORT_CS_QUORUM
|
||||
+ {"corosync", 0, 0, 'C', "\tOnly try connecting to an Corosync-based cluster"},
|
||||
+#endif
|
||||
#ifdef SUPPORT_HEARTBEAT
|
||||
{"heartbeat", 0, 0, 'H', "Only try connecting to a Heartbeat-based cluster"},
|
||||
#endif
|
||||
@@ -223,6 +226,138 @@ int tools_remove_node_cache(const char *node, const char *target)
|
||||
return rc > 0 ? 0 : rc;
|
||||
}
|
||||
|
||||
+static gint
|
||||
+compare_node_uname(gconstpointer a, gconstpointer b)
|
||||
+{
|
||||
+ const crm_node_t *a_node = a;
|
||||
+ const crm_node_t *b_node = b;
|
||||
+ return strcmp(a_node->uname?a_node->uname:"", b_node->uname?b_node->uname:"");
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+node_mcp_dispatch(const char *buffer, ssize_t length, gpointer userdata)
|
||||
+{
|
||||
+ xmlNode *msg = string2xml(buffer);
|
||||
+
|
||||
+ if (msg) {
|
||||
+ xmlNode *node = NULL;
|
||||
+ GListPtr nodes = NULL;
|
||||
+ GListPtr iter = NULL;
|
||||
+
|
||||
+ crm_log_xml_trace(msg, "message");
|
||||
+
|
||||
+ for (node = __xml_first_child(msg); node != NULL; node = __xml_next(node)) {
|
||||
+ crm_node_t *peer = calloc(1, sizeof(crm_node_t));
|
||||
+
|
||||
+ nodes = g_list_insert_sorted(nodes, peer, compare_node_uname);
|
||||
+ peer->uname = (char*)crm_element_value_copy(node, "uname");
|
||||
+ peer->state = (char*)crm_element_value_copy(node, "state");
|
||||
+ crm_element_value_int(node, "id", (int*)&peer->id);
|
||||
+ }
|
||||
+
|
||||
+ for(iter = nodes; iter; iter = iter->next) {
|
||||
+ crm_node_t *peer = iter->data;
|
||||
+ if (command == 'l') {
|
||||
+ fprintf(stdout, "%u %s %s\n", peer->id, peer->uname, peer->state);
|
||||
+
|
||||
+ } else if (command == 'p') {
|
||||
+ if(safe_str_eq(peer->state, CRM_NODE_MEMBER)) {
|
||||
+ fprintf(stdout, "%s ", peer->uname);
|
||||
+ }
|
||||
+
|
||||
+ } else if (command == 'i') {
|
||||
+ if(safe_str_eq(peer->state, CRM_NODE_MEMBER)) {
|
||||
+ fprintf(stdout, "%u ", peer->id);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ g_list_free_full(nodes, free);
|
||||
+ free_xml(msg);
|
||||
+
|
||||
+ if (command == 'p') {
|
||||
+ fprintf(stdout, "\n");
|
||||
+ }
|
||||
+
|
||||
+ crm_exit(pcmk_ok);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+node_mcp_destroy(gpointer user_data)
|
||||
+{
|
||||
+ crm_exit(ENOTCONN);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+try_pacemaker(int command, enum cluster_type_e stack)
|
||||
+{
|
||||
+ struct ipc_client_callbacks node_callbacks = {
|
||||
+ .dispatch = node_mcp_dispatch,
|
||||
+ .destroy = node_mcp_destroy
|
||||
+ };
|
||||
+
|
||||
+ if (stack == pcmk_cluster_heartbeat) {
|
||||
+ /* Nothing to do for them */
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ switch (command) {
|
||||
+ case 'e':
|
||||
+ /* Age only applies to heartbeat clusters */
|
||||
+ fprintf(stdout, "1\n");
|
||||
+ crm_exit(pcmk_ok);
|
||||
+
|
||||
+ case 'q':
|
||||
+ /* Implement one day?
|
||||
+ * Wouldn't be much for pacemakerd to track it and include in the poke reply
|
||||
+ */
|
||||
+ return FALSE;
|
||||
+
|
||||
+ case 'R':
|
||||
+ {
|
||||
+ int lpc = 0;
|
||||
+ const char *daemons[] = {
|
||||
+ CRM_SYSTEM_CRMD,
|
||||
+ "stonith-ng",
|
||||
+ T_ATTRD,
|
||||
+ CRM_SYSTEM_MCP,
|
||||
+ };
|
||||
+
|
||||
+ for(lpc = 0; lpc < DIMOF(daemons); lpc++) {
|
||||
+ if (tools_remove_node_cache(target_uname, daemons[lpc])) {
|
||||
+ crm_err("Failed to connect to %s to remove node '%s'", daemons[lpc], target_uname);
|
||||
+ crm_exit(pcmk_err_generic);
|
||||
+ }
|
||||
+ }
|
||||
+ crm_exit(pcmk_ok);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case 'i':
|
||||
+ case 'l':
|
||||
+ case 'p':
|
||||
+ /* Go to pacemakerd */
|
||||
+ {
|
||||
+ GMainLoop *amainloop = g_main_new(FALSE);
|
||||
+ mainloop_io_t *ipc =
|
||||
+ mainloop_add_ipc_client(CRM_SYSTEM_MCP, G_PRIORITY_DEFAULT, 0, NULL, &node_callbacks);
|
||||
+ if (ipc != NULL) {
|
||||
+ /* Sending anything will get us a list of nodes */
|
||||
+ xmlNode *poke = create_xml_node(NULL, "poke");
|
||||
+
|
||||
+ crm_ipc_send(mainloop_get_ipc_client(ipc), poke, 0, 0, NULL);
|
||||
+ free_xml(poke);
|
||||
+ g_main_run(amainloop);
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
#if SUPPORT_HEARTBEAT
|
||||
# include <ocf/oc_event.h>
|
||||
# include <ocf/oc_membership.h>
|
||||
@@ -626,66 +761,6 @@ ais_membership_dispatch(cpg_handle_t handle,
|
||||
# include <corosync/quorum.h>
|
||||
# include <corosync/cpg.h>
|
||||
|
||||
-static gint
|
||||
-compare_node_uname(gconstpointer a, gconstpointer b)
|
||||
-{
|
||||
- const crm_node_t *a_node = a;
|
||||
- const crm_node_t *b_node = b;
|
||||
- return strcmp(a_node->uname?a_node->uname:"", b_node->uname?b_node->uname:"");
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-node_mcp_dispatch(const char *buffer, ssize_t length, gpointer userdata)
|
||||
-{
|
||||
- xmlNode *msg = string2xml(buffer);
|
||||
-
|
||||
- if (msg) {
|
||||
- xmlNode *node = NULL;
|
||||
- GListPtr nodes = NULL;
|
||||
- GListPtr iter = NULL;
|
||||
-
|
||||
- crm_log_xml_trace(msg, "message");
|
||||
-
|
||||
- for (node = __xml_first_child(msg); node != NULL; node = __xml_next(node)) {
|
||||
- crm_node_t *peer = calloc(1, sizeof(crm_node_t));
|
||||
-
|
||||
- nodes = g_list_insert_sorted(nodes, peer, compare_node_uname);
|
||||
- peer->uname = (char*)crm_element_value_copy(node, "uname");
|
||||
- peer->state = (char*)crm_element_value_copy(node, "state");
|
||||
- crm_element_value_int(node, "id", (int*)&peer->id);
|
||||
- }
|
||||
-
|
||||
- for(iter = nodes; iter; iter = iter->next) {
|
||||
- crm_node_t *peer = iter->data;
|
||||
- if (command == 'l') {
|
||||
- fprintf(stdout, "%u %s\n", peer->id, peer->uname);
|
||||
-
|
||||
- } else if (command == 'p') {
|
||||
- if(safe_str_eq(peer->state, CRM_NODE_MEMBER)) {
|
||||
- fprintf(stdout, "%s ", peer->uname);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- g_list_free_full(nodes, free);
|
||||
- free_xml(msg);
|
||||
-
|
||||
- if (command == 'p') {
|
||||
- fprintf(stdout, "\n");
|
||||
- }
|
||||
-
|
||||
- crm_exit(pcmk_ok);
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-node_mcp_destroy(gpointer user_data)
|
||||
-{
|
||||
- crm_exit(ENOTCONN);
|
||||
-}
|
||||
-
|
||||
static gboolean
|
||||
try_corosync(int command, enum cluster_type_e stack)
|
||||
{
|
||||
@@ -696,36 +771,7 @@ try_corosync(int command, enum cluster_type_e stack)
|
||||
cpg_handle_t c_handle = 0;
|
||||
quorum_handle_t q_handle = 0;
|
||||
|
||||
- mainloop_io_t *ipc = NULL;
|
||||
- GMainLoop *amainloop = NULL;
|
||||
- const char *daemons[] = {
|
||||
- CRM_SYSTEM_CRMD,
|
||||
- "stonith-ng",
|
||||
- T_ATTRD,
|
||||
- CRM_SYSTEM_MCP,
|
||||
- };
|
||||
-
|
||||
- struct ipc_client_callbacks node_callbacks = {
|
||||
- .dispatch = node_mcp_dispatch,
|
||||
- .destroy = node_mcp_destroy
|
||||
- };
|
||||
-
|
||||
switch (command) {
|
||||
- case 'R':
|
||||
- for(rc = 0; rc < DIMOF(daemons); rc++) {
|
||||
- if (tools_remove_node_cache(target_uname, daemons[rc])) {
|
||||
- crm_err("Failed to connect to %s to remove node '%s'", daemons[rc], target_uname);
|
||||
- crm_exit(pcmk_err_generic);
|
||||
- }
|
||||
- }
|
||||
- crm_exit(pcmk_ok);
|
||||
- break;
|
||||
-
|
||||
- case 'e':
|
||||
- /* Age makes no sense (yet) in an AIS cluster */
|
||||
- fprintf(stdout, "1\n");
|
||||
- crm_exit(pcmk_ok);
|
||||
-
|
||||
case 'q':
|
||||
/* Go direct to the Quorum API */
|
||||
rc = quorum_initialize(&q_handle, NULL, &quorum_type);
|
||||
@@ -766,21 +812,8 @@ try_corosync(int command, enum cluster_type_e stack)
|
||||
cpg_finalize(c_handle);
|
||||
crm_exit(pcmk_ok);
|
||||
|
||||
- case 'l':
|
||||
- case 'p':
|
||||
- /* Go to pacemakerd */
|
||||
- amainloop = g_main_new(FALSE);
|
||||
- ipc =
|
||||
- mainloop_add_ipc_client(CRM_SYSTEM_MCP, G_PRIORITY_DEFAULT, 0, NULL,
|
||||
- &node_callbacks);
|
||||
- if (ipc != NULL) {
|
||||
- /* Sending anything will get us a list of nodes */
|
||||
- xmlNode *poke = create_xml_node(NULL, "poke");
|
||||
-
|
||||
- crm_ipc_send(mainloop_get_ipc_client(ipc), poke, 0, 0, NULL);
|
||||
- free_xml(poke);
|
||||
- g_main_run(amainloop);
|
||||
- }
|
||||
+ default:
|
||||
+ try_pacemaker(command, stack);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -963,5 +996,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
+ try_pacemaker(command, try_stack);
|
||||
+
|
||||
return (1);
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 3 Sep 2015 12:27:59 +1000
|
||||
Subject: [PATCH] Fix: corosync: Display node state and quorum data if
|
||||
available
|
||||
|
||||
(cherry picked from commit 4d4c92e515bbaf74917a311e19d5995b30c29430)
|
||||
---
|
||||
mcp/pacemaker.c | 7 +++++++
|
||||
tools/crm_node.c | 17 ++++++++++-------
|
||||
2 files changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
|
||||
index f9fc015..9c3195e 100644
|
||||
--- a/mcp/pacemaker.c
|
||||
+++ b/mcp/pacemaker.c
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
+
|
||||
+gboolean pcmk_quorate = FALSE;
|
||||
gboolean fatal_error = FALSE;
|
||||
GMainLoop *mainloop = NULL;
|
||||
|
||||
@@ -560,6 +562,10 @@ update_process_clients(crm_client_t *client)
|
||||
crm_node_t *node = NULL;
|
||||
xmlNode *update = create_xml_node(NULL, "nodes");
|
||||
|
||||
+ if (is_corosync_cluster()) {
|
||||
+ crm_xml_add_int(update, "quorate", pcmk_quorate);
|
||||
+ }
|
||||
+
|
||||
g_hash_table_iter_init(&iter, crm_peer_cache);
|
||||
while (g_hash_table_iter_next(&iter, NULL, (gpointer *) & node)) {
|
||||
xmlNode *xml = create_xml_node(update, "node");
|
||||
@@ -896,6 +902,7 @@ static gboolean
|
||||
mcp_quorum_callback(unsigned long long seq, gboolean quorate)
|
||||
{
|
||||
/* Nothing to do */
|
||||
+ pcmk_quorate = quorate;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
diff --git a/tools/crm_node.c b/tools/crm_node.c
|
||||
index 308d4f9..9626120 100644
|
||||
--- a/tools/crm_node.c
|
||||
+++ b/tools/crm_node.c
|
||||
@@ -243,8 +243,16 @@ node_mcp_dispatch(const char *buffer, ssize_t length, gpointer userdata)
|
||||
xmlNode *node = NULL;
|
||||
GListPtr nodes = NULL;
|
||||
GListPtr iter = NULL;
|
||||
+ const char *quorate = crm_element_value(msg, "quorate");
|
||||
|
||||
crm_log_xml_trace(msg, "message");
|
||||
+ if (command == 'q' && quorate != NULL) {
|
||||
+ fprintf(stdout, "%s\n", quorate);
|
||||
+ crm_exit(pcmk_ok);
|
||||
+
|
||||
+ } else if(command == 'q') {
|
||||
+ crm_exit(1);
|
||||
+ }
|
||||
|
||||
for (node = __xml_first_child(msg); node != NULL; node = __xml_next(node)) {
|
||||
crm_node_t *peer = calloc(1, sizeof(crm_node_t));
|
||||
@@ -258,7 +266,7 @@ node_mcp_dispatch(const char *buffer, ssize_t length, gpointer userdata)
|
||||
for(iter = nodes; iter; iter = iter->next) {
|
||||
crm_node_t *peer = iter->data;
|
||||
if (command == 'l') {
|
||||
- fprintf(stdout, "%u %s %s\n", peer->id, peer->uname, peer->state);
|
||||
+ fprintf(stdout, "%u %s %s\n", peer->id, peer->uname, peer->state?peer->state:"");
|
||||
|
||||
} else if (command == 'p') {
|
||||
if(safe_str_eq(peer->state, CRM_NODE_MEMBER)) {
|
||||
@@ -310,12 +318,6 @@ try_pacemaker(int command, enum cluster_type_e stack)
|
||||
fprintf(stdout, "1\n");
|
||||
crm_exit(pcmk_ok);
|
||||
|
||||
- case 'q':
|
||||
- /* Implement one day?
|
||||
- * Wouldn't be much for pacemakerd to track it and include in the poke reply
|
||||
- */
|
||||
- return FALSE;
|
||||
-
|
||||
case 'R':
|
||||
{
|
||||
int lpc = 0;
|
||||
@@ -338,6 +340,7 @@ try_pacemaker(int command, enum cluster_type_e stack)
|
||||
|
||||
case 'i':
|
||||
case 'l':
|
||||
+ case 'q':
|
||||
case 'p':
|
||||
/* Go to pacemakerd */
|
||||
{
|
@ -0,0 +1,23 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 3 Sep 2015 13:27:57 +1000
|
||||
Subject: [PATCH] Fix: pacemakerd: Do not forget about nodes that leave the
|
||||
cluster
|
||||
|
||||
(cherry picked from commit 2ac396ae6f54c9437bcf786eeccf94d4e2fdd77a)
|
||||
---
|
||||
mcp/pacemaker.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
|
||||
index 9c3195e..88a6a1f 100644
|
||||
--- a/mcp/pacemaker.c
|
||||
+++ b/mcp/pacemaker.c
|
||||
@@ -1108,6 +1108,8 @@ main(int argc, char **argv)
|
||||
cluster.cpg.cpg_deliver_fn = mcp_cpg_deliver;
|
||||
cluster.cpg.cpg_confchg_fn = mcp_cpg_membership;
|
||||
|
||||
+ crm_set_autoreap(FALSE);
|
||||
+
|
||||
if(cluster_connect_cpg(&cluster) == FALSE) {
|
||||
crm_err("Couldn't connect to Corosync's CPG service");
|
||||
rc = -ENOPROTOOPT;
|
58
0021-Fix-pacemakerd-Track-node-state-in-pacemakerd.patch
Normal file
58
0021-Fix-pacemakerd-Track-node-state-in-pacemakerd.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 3 Sep 2015 14:29:27 +1000
|
||||
Subject: [PATCH] Fix: pacemakerd: Track node state in pacemakerd
|
||||
|
||||
(cherry picked from commit c186f54241c49bf20b1620767933b006063d613c)
|
||||
---
|
||||
mcp/pacemaker.c | 22 +++++++++++++++++++++-
|
||||
1 file changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
|
||||
index 88a6a1f..9f00a21 100644
|
||||
--- a/mcp/pacemaker.c
|
||||
+++ b/mcp/pacemaker.c
|
||||
@@ -901,7 +901,6 @@ mcp_cpg_membership(cpg_handle_t handle,
|
||||
static gboolean
|
||||
mcp_quorum_callback(unsigned long long seq, gboolean quorate)
|
||||
{
|
||||
- /* Nothing to do */
|
||||
pcmk_quorate = quorate;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -909,8 +908,23 @@ mcp_quorum_callback(unsigned long long seq, gboolean quorate)
|
||||
static void
|
||||
mcp_quorum_destroy(gpointer user_data)
|
||||
{
|
||||
+ crm_info("connection lost");
|
||||
+}
|
||||
+
|
||||
+#if SUPPORT_CMAN
|
||||
+static gboolean
|
||||
+mcp_cman_dispatch(unsigned long long seq, gboolean quorate)
|
||||
+{
|
||||
+ pcmk_quorate = quorate;
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+mcp_cman_destroy(gpointer user_data)
|
||||
+{
|
||||
crm_info("connection closed");
|
||||
}
|
||||
+#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -1122,6 +1136,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
+#if SUPPORT_CMAN
|
||||
+ if (rc == pcmk_ok && is_cman_cluster()) {
|
||||
+ init_cman_connection(mcp_cman_dispatch, mcp_cman_destroy);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if(rc == pcmk_ok) {
|
||||
local_name = get_local_node_name();
|
||||
update_node_processes(local_nodeid, local_name, get_process_list());
|
27
0022-Fix-PE-Resolve-memory-leak.patch
Normal file
27
0022-Fix-PE-Resolve-memory-leak.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 8 Sep 2015 12:02:54 +1000
|
||||
Subject: [PATCH] Fix: PE: Resolve memory leak
|
||||
|
||||
(cherry picked from commit 4f48a79fd19be0e614716f0900e31985d4714ace)
|
||||
---
|
||||
lib/pengine/unpack.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c
|
||||
index 156a192..c4f3134 100644
|
||||
--- a/lib/pengine/unpack.c
|
||||
+++ b/lib/pengine/unpack.c
|
||||
@@ -276,9 +276,13 @@ destroy_digest_cache(gpointer ptr)
|
||||
op_digest_cache_t *data = ptr;
|
||||
|
||||
free_xml(data->params_all);
|
||||
+ free_xml(data->params_secure);
|
||||
free_xml(data->params_restart);
|
||||
+
|
||||
free(data->digest_all_calc);
|
||||
free(data->digest_restart_calc);
|
||||
+ free(data->digest_secure_calc);
|
||||
+
|
||||
free(data);
|
||||
}
|
||||
|
24
0023-Fix-cman-Purge-all-node-caches-for-crm_node-R.patch
Normal file
24
0023-Fix-cman-Purge-all-node-caches-for-crm_node-R.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 8 Sep 2015 12:03:56 +1000
|
||||
Subject: [PATCH] Fix: cman: Purge all node caches for crm_node -R
|
||||
|
||||
(cherry picked from commit c445e135b6d52b1a5f3cfdacfa54a63b313c00d2)
|
||||
---
|
||||
tools/crm_node.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_node.c b/tools/crm_node.c
|
||||
index 9626120..48ee7c4 100644
|
||||
--- a/tools/crm_node.c
|
||||
+++ b/tools/crm_node.c
|
||||
@@ -607,9 +607,7 @@ try_cman(int command, enum cluster_type_e stack)
|
||||
|
||||
switch (command) {
|
||||
case 'R':
|
||||
- if (tools_remove_node_cache(target_uname, CRM_SYSTEM_CRMD)) {
|
||||
- crm_err("Failed to connect to "CRM_SYSTEM_CRMD" to remove node '%s'", target_uname);
|
||||
- }
|
||||
+ try_pacemaker(command, stack);
|
||||
break;
|
||||
|
||||
case 'e':
|
@ -0,0 +1,92 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Tue, 8 Sep 2015 12:05:04 +1000
|
||||
Subject: [PATCH] Refactor: membership: Safely autoreap nodes without code
|
||||
duplication
|
||||
|
||||
(cherry picked from commit acd660a1bdf40ada599041cb14d2128632d2e7a5)
|
||||
---
|
||||
lib/cluster/membership.c | 43 +++++++++++++++++++++----------------------
|
||||
1 file changed, 21 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/lib/cluster/membership.c b/lib/cluster/membership.c
|
||||
index b7958eb..3081e54 100644
|
||||
--- a/lib/cluster/membership.c
|
||||
+++ b/lib/cluster/membership.c
|
||||
@@ -795,8 +795,8 @@ crm_update_peer_expected(const char *source, crm_node_t * node, const char *expe
|
||||
* called within a cache iteration if reaping is possible,
|
||||
* otherwise reaping could invalidate the iterator.
|
||||
*/
|
||||
-crm_node_t *
|
||||
-crm_update_peer_state(const char *source, crm_node_t * node, const char *state, int membership)
|
||||
+static crm_node_t *
|
||||
+crm_update_peer_state_iter(const char *source, crm_node_t * node, const char *state, int membership, GHashTableIter *iter)
|
||||
{
|
||||
gboolean is_member;
|
||||
|
||||
@@ -822,13 +822,19 @@ crm_update_peer_state(const char *source, crm_node_t * node, const char *state,
|
||||
free(last);
|
||||
|
||||
if (!is_member && crm_autoreap) {
|
||||
- if (status_type == crm_status_rstate) {
|
||||
+ if(iter) {
|
||||
+ crm_notice("Purged 1 peer with id=%u and/or uname=%s from the membership cache", node->id, node->uname);
|
||||
+ g_hash_table_iter_remove(iter);
|
||||
+
|
||||
+ } else if (status_type == crm_status_rstate) {
|
||||
crm_remote_peer_cache_remove(node->uname);
|
||||
+
|
||||
} else {
|
||||
reap_crm_member(node->id, node->uname);
|
||||
}
|
||||
node = NULL;
|
||||
}
|
||||
+
|
||||
} else {
|
||||
crm_trace("%s: Node %s[%u] - state is unchanged (%s)", source, node->uname, node->id,
|
||||
state);
|
||||
@@ -836,6 +842,12 @@ crm_update_peer_state(const char *source, crm_node_t * node, const char *state,
|
||||
return node;
|
||||
}
|
||||
|
||||
+crm_node_t *
|
||||
+crm_update_peer_state(const char *source, crm_node_t * node, const char *state, int membership)
|
||||
+{
|
||||
+ return crm_update_peer_state_iter(source, node, state, membership, NULL);
|
||||
+}
|
||||
+
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Reap all nodes from cache whose membership information does not match
|
||||
@@ -853,26 +865,13 @@ crm_reap_unseen_nodes(uint64_t membership)
|
||||
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&node)) {
|
||||
if (node->last_seen != membership) {
|
||||
if (node->state) {
|
||||
- /* crm_update_peer_state() cannot be called here, because that
|
||||
- * might modify the peer cache, invalidating our iterator
|
||||
+ /*
|
||||
+ * Calling crm_update_peer_state_iter() allows us to
|
||||
+ * remove the node from crm_peer_cache without
|
||||
+ * invalidating our iterator
|
||||
*/
|
||||
- if (safe_str_eq(node->state, CRM_NODE_LOST)) {
|
||||
- crm_trace("Node %s[%u] - state is unchanged (%s)",
|
||||
- node->uname, node->id, CRM_NODE_LOST);
|
||||
- } else {
|
||||
- char *last = node->state;
|
||||
-
|
||||
- node->state = strdup(CRM_NODE_LOST);
|
||||
- crm_notice("Node %s[%u] - state is now %s (was %s)",
|
||||
- node->uname, node->id, CRM_NODE_LOST, last);
|
||||
- if (crm_status_callback) {
|
||||
- crm_status_callback(crm_status_nstate, node, last);
|
||||
- }
|
||||
- if (crm_autoreap) {
|
||||
- g_hash_table_iter_remove(&iter);
|
||||
- }
|
||||
- free(last);
|
||||
- }
|
||||
+ crm_update_peer_state_iter(__FUNCTION__, node, CRM_NODE_LOST, membership, &iter);
|
||||
+
|
||||
} else {
|
||||
crm_info("State of node %s[%u] is still unknown",
|
||||
node->uname, node->id);
|
@ -0,0 +1,23 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 9 Sep 2015 14:46:49 +1000
|
||||
Subject: [PATCH] Fix: crmd: Prevent segfault by correctly detecting when
|
||||
notifications are not required
|
||||
|
||||
(cherry picked from commit 5eb9f93ef666c75e5f32827a92b0a57ada063803)
|
||||
---
|
||||
crmd/notify.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/crmd/notify.c b/crmd/notify.c
|
||||
index ca2be0f..179af18 100644
|
||||
--- a/crmd/notify.c
|
||||
+++ b/crmd/notify.c
|
||||
@@ -141,7 +141,7 @@ crmd_notify_fencing_op(stonith_event_t * e)
|
||||
{
|
||||
char *desc = NULL;
|
||||
|
||||
- if(notify_script) {
|
||||
+ if(notify_script == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Thu, 27 Aug 2015 11:00:02 -0500
|
||||
Subject: [PATCH] Fix: crmd: don't add node ID to proxied remote node requests
|
||||
for attrd
|
||||
|
||||
446a1005 incorrectly set F_ATTRD_HOST_ID for proxied remote node requests to
|
||||
attrd. Since attrd only uses F_ATTRD_HOST_ID to associate a cluster node name
|
||||
with an ID, it doesn't ever need to be set for remote nodes.
|
||||
|
||||
Additionally, that revision used the proxying cluster node's node ID, which can
|
||||
lead to node ID conflicts in attrd.
|
||||
|
||||
(cherry picked from commit 6af6da534646dbadf3d8d1d63d0edb2844c72073)
|
||||
---
|
||||
crmd/lrm_state.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/crmd/lrm_state.c b/crmd/lrm_state.c
|
||||
index c03fa0b..bea1027 100644
|
||||
--- a/crmd/lrm_state.c
|
||||
+++ b/crmd/lrm_state.c
|
||||
@@ -540,7 +540,6 @@ remote_proxy_cb(lrmd_t *lrmd, void *userdata, xmlNode *msg)
|
||||
if (safe_str_eq(type, T_ATTRD)
|
||||
&& crm_element_value(request, F_ATTRD_HOST) == NULL) {
|
||||
crm_xml_add(request, F_ATTRD_HOST, proxy->node_name);
|
||||
- crm_xml_add_int(request, F_ATTRD_HOST_ID, get_local_nodeid(0));
|
||||
}
|
||||
|
||||
rc = crm_ipc_send(proxy->ipc, request, flags, 5000, NULL);
|
@ -0,0 +1,35 @@
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Mon, 14 Sep 2015 15:00:13 -0500
|
||||
Subject: [PATCH] Fix: pacemaker_remote: memory leak in ipc_proxy_dispatch()
|
||||
|
||||
Detected via routine valgrind testing
|
||||
|
||||
(cherry picked from commit 3bb439d1554cb5567b886c52107bd3bb6f27b696)
|
||||
---
|
||||
lrmd/ipc_proxy.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lrmd/ipc_proxy.c b/lrmd/ipc_proxy.c
|
||||
index 9427393..2a5ad78 100644
|
||||
--- a/lrmd/ipc_proxy.c
|
||||
+++ b/lrmd/ipc_proxy.c
|
||||
@@ -223,9 +223,9 @@ ipc_proxy_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
|
||||
}
|
||||
|
||||
CRM_CHECK(client != NULL, crm_err("Invalid client");
|
||||
- return FALSE);
|
||||
+ free_xml(request); return FALSE);
|
||||
CRM_CHECK(client->id != NULL, crm_err("Invalid client: %p", client);
|
||||
- return FALSE);
|
||||
+ free_xml(request); return FALSE);
|
||||
|
||||
/* this ensures that synced request/responses happen over the event channel
|
||||
* in the crmd, allowing the crmd to process the messages async */
|
||||
@@ -241,6 +241,7 @@ ipc_proxy_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
|
||||
crm_xml_add_int(msg, F_LRMD_IPC_MSG_FLAGS, flags);
|
||||
add_message_xml(msg, F_LRMD_IPC_MSG, request);
|
||||
lrmd_server_send_notify(ipc_proxy, msg);
|
||||
+ free_xml(request);
|
||||
free_xml(msg);
|
||||
|
||||
return 0;
|
115
0028-Log-The-package-version-is-more-informative.patch
Normal file
115
0028-Log-The-package-version-is-more-informative.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 16 Sep 2015 09:14:39 +1000
|
||||
Subject: [PATCH] Log: The package version is more informative
|
||||
|
||||
(cherry picked from commit 2b4d195e9e94777fc1953832fcce3637ffa2f449)
|
||||
---
|
||||
crmd/cib.c | 2 +-
|
||||
crmd/election.c | 2 +-
|
||||
crmd/main.c | 5 ++---
|
||||
lib/ais/plugin.c | 2 +-
|
||||
lib/common/utils.c | 4 ++--
|
||||
mcp/pacemaker.c | 4 ++--
|
||||
6 files changed, 9 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/crmd/cib.c b/crmd/cib.c
|
||||
index 7ec5eda..41e9efb 100644
|
||||
--- a/crmd/cib.c
|
||||
+++ b/crmd/cib.c
|
||||
@@ -113,7 +113,7 @@ revision_check_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, vo
|
||||
cmp = compare_version(revision, CRM_FEATURE_SET);
|
||||
|
||||
if (cmp > 0) {
|
||||
- crm_err("This build (%s) does not support the current resource configuration", VERSION);
|
||||
+ crm_err("This build (%s) does not support the current resource configuration", PACEMAKER_VERSION);
|
||||
crm_err("We can only support up to CRM feature set %s (current=%s)",
|
||||
CRM_FEATURE_SET, revision);
|
||||
crm_err("Shutting down the CRM");
|
||||
diff --git a/crmd/election.c b/crmd/election.c
|
||||
index b542a66..adab4e3 100644
|
||||
--- a/crmd/election.c
|
||||
+++ b/crmd/election.c
|
||||
@@ -215,7 +215,7 @@ do_dc_takeover(long long action,
|
||||
}
|
||||
|
||||
update_attr_delegate(fsa_cib_conn, cib_none, XML_CIB_TAG_CRMCONFIG, NULL, NULL, NULL, NULL,
|
||||
- "dc-version", VERSION "-" BUILD_VERSION, FALSE, NULL, NULL);
|
||||
+ "dc-version", PACEMAKER_VERSION "-" BUILD_VERSION, FALSE, NULL, NULL);
|
||||
|
||||
update_attr_delegate(fsa_cib_conn, cib_none, XML_CIB_TAG_CRMCONFIG, NULL, NULL, NULL, NULL,
|
||||
"cluster-infrastructure", cluster_type, FALSE, NULL, NULL);
|
||||
diff --git a/crmd/main.c b/crmd/main.c
|
||||
index e9a69b4..75ed91c 100644
|
||||
--- a/crmd/main.c
|
||||
+++ b/crmd/main.c
|
||||
@@ -89,13 +89,12 @@ main(int argc, char **argv)
|
||||
crmd_metadata();
|
||||
return 0;
|
||||
} else if (argc - optind == 1 && safe_str_eq("version", argv[optind])) {
|
||||
- fprintf(stdout, "CRM Version: ");
|
||||
- fprintf(stdout, "%s (%s)\n", VERSION, BUILD_VERSION);
|
||||
+ fprintf(stdout, "CRM Version: %s (%s)\n", PACEMAKER_VERSION, BUILD_VERSION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
|
||||
- crm_notice("CRM Git Version: %s\n", BUILD_VERSION);
|
||||
+ crm_notice("CRM Git Version: %s (%s)\n", PACEMAKER_VERSION, BUILD_VERSION);
|
||||
|
||||
if (optind > argc) {
|
||||
++argerr;
|
||||
diff --git a/lib/ais/plugin.c b/lib/ais/plugin.c
|
||||
index ab534fa..cf2a131 100644
|
||||
--- a/lib/ais/plugin.c
|
||||
+++ b/lib/ais/plugin.c
|
||||
@@ -201,7 +201,7 @@ static struct corosync_exec_handler pcmk_exec_service[] = {
|
||||
*/
|
||||
/* *INDENT-OFF* */
|
||||
struct corosync_service_engine pcmk_service_handler = {
|
||||
- .name = (char *)"Pacemaker Cluster Manager "PACKAGE_VERSION,
|
||||
+ .name = (char *)"Pacemaker Cluster Manager "PACEMAKER_VERSION,
|
||||
.id = PCMK_SERVICE_ID,
|
||||
.private_data_size = 0,
|
||||
.flow_control = COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED,
|
||||
diff --git a/lib/common/utils.c b/lib/common/utils.c
|
||||
index 628cf2f..2364f5c 100644
|
||||
--- a/lib/common/utils.c
|
||||
+++ b/lib/common/utils.c
|
||||
@@ -1603,13 +1603,13 @@ crm_help(char cmd, int exit_code)
|
||||
FILE *stream = (exit_code ? stderr : stdout);
|
||||
|
||||
if (cmd == 'v' || cmd == '$') {
|
||||
- fprintf(stream, "Pacemaker %s\n", VERSION);
|
||||
+ fprintf(stream, "Pacemaker %s\n", PACEMAKER_VERSION);
|
||||
fprintf(stream, "Written by Andrew Beekhof\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (cmd == '!') {
|
||||
- fprintf(stream, "Pacemaker %s (Build: %s): %s\n", VERSION, BUILD_VERSION, CRM_FEATURES);
|
||||
+ fprintf(stream, "Pacemaker %s (Build: %s): %s\n", PACEMAKER_VERSION, BUILD_VERSION, CRM_FEATURES);
|
||||
goto out;
|
||||
}
|
||||
|
||||
diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
|
||||
index 9f00a21..910d154 100644
|
||||
--- a/mcp/pacemaker.c
|
||||
+++ b/mcp/pacemaker.c
|
||||
@@ -972,7 +972,7 @@ main(int argc, char **argv)
|
||||
shutdown = TRUE;
|
||||
break;
|
||||
case 'F':
|
||||
- printf("Pacemaker %s (Build: %s)\n Supporting v%s: %s\n", VERSION, BUILD_VERSION,
|
||||
+ printf("Pacemaker %s (Build: %s)\n Supporting v%s: %s\n", PACEMAKER_VERSION, BUILD_VERSION,
|
||||
CRM_FEATURE_SET, CRM_FEATURES);
|
||||
crm_exit(pcmk_ok);
|
||||
default:
|
||||
@@ -1039,7 +1039,7 @@ main(int argc, char **argv)
|
||||
crm_exit(ENODATA);
|
||||
}
|
||||
|
||||
- crm_notice("Starting Pacemaker %s (Build: %s): %s", VERSION, BUILD_VERSION, CRM_FEATURES);
|
||||
+ crm_notice("Starting Pacemaker %s (Build: %s): %s", PACEMAKER_VERSION, BUILD_VERSION, CRM_FEATURES);
|
||||
mainloop = g_main_new(FALSE);
|
||||
sysrq_init();
|
||||
|
127
0029-Fix-crm_resource-Allow-the-resource-configuration-to.patch
Normal file
127
0029-Fix-crm_resource-Allow-the-resource-configuration-to.patch
Normal file
@ -0,0 +1,127 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 17 Sep 2015 09:46:38 +1000
|
||||
Subject: [PATCH] Fix: crm_resource: Allow the resource configuration to be
|
||||
modified for --force-{check,start,..} calls
|
||||
|
||||
(cherry picked from commit 1206f735a8ddb33c77152c736828e823e7755c34)
|
||||
---
|
||||
tools/crm_resource.c | 36 +++++++++++++++++++++++++++++++-----
|
||||
tools/crm_resource.h | 2 +-
|
||||
tools/crm_resource_runtime.c | 14 +++++++++++++-
|
||||
3 files changed, 45 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
||||
index 156bbea..2a94362 100644
|
||||
--- a/tools/crm_resource.c
|
||||
+++ b/tools/crm_resource.c
|
||||
@@ -247,6 +247,7 @@ main(int argc, char **argv)
|
||||
const char *prop_set = NULL;
|
||||
const char *rsc_long_cmd = NULL;
|
||||
const char *longname = NULL;
|
||||
+ GHashTable *override_params = NULL;
|
||||
|
||||
char *xml_file = NULL;
|
||||
crm_ipc_t *crmd_channel = NULL;
|
||||
@@ -503,11 +504,35 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
- if (optind < argc && argv[optind] != NULL) {
|
||||
+ if (optind < argc
|
||||
+ && argv[optind] != NULL
|
||||
+ && rsc_cmd == 0
|
||||
+ && rsc_long_cmd) {
|
||||
+
|
||||
+ override_params = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
|
||||
+ while (optind < argc && argv[optind] != NULL) {
|
||||
+ char *name = calloc(1, strlen(argv[optind]));
|
||||
+ char *value = calloc(1, strlen(argv[optind]));
|
||||
+ int rc = sscanf(argv[optind], "%[^=]=%s", name, value);
|
||||
+
|
||||
+ if(rc == 2) {
|
||||
+ g_hash_table_replace(override_params, name, value);
|
||||
+
|
||||
+ } else {
|
||||
+ CMD_ERR("Error parsing '%s' as a name=value pair for --%s", argv[optind], rsc_long_cmd);
|
||||
+ free(value);
|
||||
+ free(name);
|
||||
+ argerr++;
|
||||
+ }
|
||||
+ optind++;
|
||||
+ }
|
||||
+
|
||||
+ } else if (optind < argc && argv[optind] != NULL && rsc_cmd == 0) {
|
||||
CMD_ERR("non-option ARGV-elements: ");
|
||||
while (optind < argc && argv[optind] != NULL) {
|
||||
- CMD_ERR("%s ", argv[optind++]);
|
||||
- ++argerr;
|
||||
+ CMD_ERR("[%d of %d] %s ", optind, argc, argv[optind]);
|
||||
+ optind++;
|
||||
+ argerr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +541,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argerr) {
|
||||
- crm_help('?', EX_USAGE);
|
||||
+ CMD_ERR("Invalid option(s) supplied, use --help for valid usage");
|
||||
+ return crm_exit(EX_USAGE);
|
||||
}
|
||||
|
||||
our_pid = calloc(1, 11);
|
||||
@@ -631,7 +657,7 @@ main(int argc, char **argv)
|
||||
rc = wait_till_stable(timeout_ms, cib_conn);
|
||||
|
||||
} else if (rsc_cmd == 0 && rsc_long_cmd) { /* force-(stop|start|check) */
|
||||
- rc = cli_resource_execute(rsc_id, rsc_long_cmd, cib_conn, &data_set);
|
||||
+ rc = cli_resource_execute(rsc_id, rsc_long_cmd, override_params, cib_conn, &data_set);
|
||||
|
||||
} else if (rsc_cmd == 'A' || rsc_cmd == 'a') {
|
||||
GListPtr lpc = NULL;
|
||||
diff --git a/tools/crm_resource.h b/tools/crm_resource.h
|
||||
index 5a206e0..d4c3b05 100644
|
||||
--- a/tools/crm_resource.h
|
||||
+++ b/tools/crm_resource.h
|
||||
@@ -74,7 +74,7 @@ int cli_resource_search(const char *rsc, pe_working_set_t * data_set);
|
||||
int cli_resource_delete(cib_t *cib_conn, crm_ipc_t * crmd_channel, const char *host_uname, resource_t * rsc, pe_working_set_t * data_set);
|
||||
int cli_resource_restart(resource_t * rsc, const char *host, int timeout_ms, cib_t * cib);
|
||||
int cli_resource_move(const char *rsc_id, const char *host_name, cib_t * cib, pe_working_set_t *data_set);
|
||||
-int cli_resource_execute(const char *rsc_id, const char *rsc_action, cib_t * cib, pe_working_set_t *data_set);
|
||||
+int cli_resource_execute(const char *rsc_id, const char *rsc_action, GHashTable *override_hash, cib_t * cib, pe_working_set_t *data_set);
|
||||
|
||||
int cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const char *attr_id,
|
||||
const char *attr_name, const char *attr_value, bool recursive,
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index b9427bc..ce9db01 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -1297,7 +1297,7 @@ wait_till_stable(int timeout_ms, cib_t * cib)
|
||||
}
|
||||
|
||||
int
|
||||
-cli_resource_execute(const char *rsc_id, const char *rsc_action, cib_t * cib, pe_working_set_t *data_set)
|
||||
+cli_resource_execute(const char *rsc_id, const char *rsc_action, GHashTable *override_hash, cib_t * cib, pe_working_set_t *data_set)
|
||||
{
|
||||
int rc = pcmk_ok;
|
||||
svc_action_t *op = NULL;
|
||||
@@ -1360,6 +1360,18 @@ cli_resource_execute(const char *rsc_id, const char *rsc_action, cib_t * cib, pe
|
||||
setenv("OCF_TRACE_RA", "1", 1);
|
||||
}
|
||||
|
||||
+ if(op && override_hash) {
|
||||
+ GHashTableIter iter;
|
||||
+ char *name = NULL;
|
||||
+ char *value = NULL;
|
||||
+
|
||||
+ g_hash_table_iter_init(&iter, override_hash);
|
||||
+ while (g_hash_table_iter_next(&iter, (gpointer *) & name, (gpointer *) & value)) {
|
||||
+ printf("Overriding the cluser configuration for '%s' with '%s' = '%s'\n", rsc->id, name, value);
|
||||
+ g_hash_table_replace(op->params, strdup(name), strdup(value));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if(op == NULL) {
|
||||
/* Re-run but with stderr enabled so we can display a sane error message */
|
||||
crm_enable_stderr(TRUE);
|
@ -0,0 +1,34 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 17 Sep 2015 14:43:15 +1000
|
||||
Subject: [PATCH] Log: lrmd: Improved logging when no pacemaker remote authkey
|
||||
is available
|
||||
|
||||
(cherry picked from commit 20c2178f076ff32fdf9ba9a467c193b8dac2f9e5)
|
||||
---
|
||||
lib/lrmd/lrmd_client.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/lrmd/lrmd_client.c b/lib/lrmd/lrmd_client.c
|
||||
index 42bdf2b..1f1ffde 100644
|
||||
--- a/lib/lrmd/lrmd_client.c
|
||||
+++ b/lib/lrmd/lrmd_client.c
|
||||
@@ -1061,13 +1061,17 @@ lrmd_tls_set_key(gnutls_datum_t * key)
|
||||
if (set_key(key, specific_location) == 0) {
|
||||
crm_debug("Using custom authkey location %s", specific_location);
|
||||
return 0;
|
||||
+
|
||||
+ } else {
|
||||
+ crm_err("No lrmd remote key found at %s, trying default locations", specific_location);
|
||||
}
|
||||
|
||||
- if (set_key(key, DEFAULT_REMOTE_KEY_LOCATION)) {
|
||||
+ if (set_key(key, DEFAULT_REMOTE_KEY_LOCATION) != 0) {
|
||||
rc = set_key(key, ALT_REMOTE_KEY_LOCATION);
|
||||
}
|
||||
+
|
||||
if (rc) {
|
||||
- crm_err("No lrmd remote key found");
|
||||
+ crm_err("No lrmd remote key found at %s", DEFAULT_REMOTE_KEY_LOCATION);
|
||||
return -1;
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
From: Ken Gaillot <kgaillot@redhat.com>
|
||||
Date: Wed, 23 Sep 2015 10:45:39 -0500
|
||||
Subject: [PATCH] Fix: liblrmd: don't print error if remote key environment
|
||||
variable unset
|
||||
|
||||
20c2178 added error logging if the remote key was unable to be read,
|
||||
however it would also log an error in the usual case where the
|
||||
environment variable was simply unset.
|
||||
|
||||
(cherry picked from commit dec3349f1252e2c2c18ed110b8cc4a2b2212b613)
|
||||
---
|
||||
lib/lrmd/lrmd_client.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/lrmd/lrmd_client.c b/lib/lrmd/lrmd_client.c
|
||||
index 1f1ffde..f365e59 100644
|
||||
--- a/lib/lrmd/lrmd_client.c
|
||||
+++ b/lib/lrmd/lrmd_client.c
|
||||
@@ -1062,8 +1062,8 @@ lrmd_tls_set_key(gnutls_datum_t * key)
|
||||
crm_debug("Using custom authkey location %s", specific_location);
|
||||
return 0;
|
||||
|
||||
- } else {
|
||||
- crm_err("No lrmd remote key found at %s, trying default locations", specific_location);
|
||||
+ } else if (specific_location) {
|
||||
+ crm_err("No valid lrmd remote key found at %s, trying default location", specific_location);
|
||||
}
|
||||
|
||||
if (set_key(key, DEFAULT_REMOTE_KEY_LOCATION) != 0) {
|
||||
@@ -1071,7 +1071,7 @@ lrmd_tls_set_key(gnutls_datum_t * key)
|
||||
}
|
||||
|
||||
if (rc) {
|
||||
- crm_err("No lrmd remote key found at %s", DEFAULT_REMOTE_KEY_LOCATION);
|
||||
+ crm_err("No valid lrmd remote key found at %s", DEFAULT_REMOTE_KEY_LOCATION);
|
||||
return -1;
|
||||
}
|
||||
|
182
0032-Fix-Tools-Repair-the-logging-of-interesting-command-.patch
Normal file
182
0032-Fix-Tools-Repair-the-logging-of-interesting-command-.patch
Normal file
@ -0,0 +1,182 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Mon, 28 Sep 2015 14:54:28 +1000
|
||||
Subject: [PATCH] Fix: Tools: Repair the logging of 'interesting' command-lines
|
||||
|
||||
(cherry picked from commit b7d6608d8b33b4e9580e04f25446176bac832fb7)
|
||||
---
|
||||
tools/attrd_updater.c | 1 +
|
||||
tools/cibadmin.c | 8 ++++++--
|
||||
tools/crm_attribute.c | 6 +++++-
|
||||
tools/crm_resource.c | 30 +++++++++++++++++++++++-------
|
||||
4 files changed, 35 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tools/attrd_updater.c b/tools/attrd_updater.c
|
||||
index 878dab5..11462ee 100644
|
||||
--- a/tools/attrd_updater.c
|
||||
+++ b/tools/attrd_updater.c
|
||||
@@ -150,6 +150,7 @@ main(int argc, char **argv)
|
||||
case 'v':
|
||||
command = flag;
|
||||
attr_value = optarg;
|
||||
+ crm_log_args(argc, argv); /* Too much? */
|
||||
break;
|
||||
default:
|
||||
++argerr;
|
||||
diff --git a/tools/cibadmin.c b/tools/cibadmin.c
|
||||
index 6b90536..c16d3c7 100644
|
||||
--- a/tools/cibadmin.c
|
||||
+++ b/tools/cibadmin.c
|
||||
@@ -213,7 +213,7 @@ main(int argc, char **argv)
|
||||
int option_index = 0;
|
||||
|
||||
crm_xml_init(); /* Sets buffer allocation strategy */
|
||||
- crm_log_preinit(NULL, argc, argv);
|
||||
+ crm_log_cli_init("cibadmin");
|
||||
crm_set_options(NULL, "command [options] [data]", long_options,
|
||||
"Provides direct access to the cluster configuration."
|
||||
"\n\nAllows the configuration, or sections of it, to be queried, modified, replaced and deleted."
|
||||
@@ -286,6 +286,7 @@ main(int argc, char **argv)
|
||||
break;
|
||||
case 'B':
|
||||
cib_action = CIB_OP_BUMP;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'V':
|
||||
command_options = command_options | cib_verbose;
|
||||
@@ -303,13 +304,16 @@ main(int argc, char **argv)
|
||||
case 'X':
|
||||
crm_trace("Option %c => %s", flag, optarg);
|
||||
admin_input_xml = optarg;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'x':
|
||||
crm_trace("Option %c => %s", flag, optarg);
|
||||
admin_input_file = optarg;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'p':
|
||||
admin_input_stdin = TRUE;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'N':
|
||||
case 'h':
|
||||
@@ -334,6 +338,7 @@ main(int argc, char **argv)
|
||||
case 'f':
|
||||
force_flag = TRUE;
|
||||
command_options |= cib_quorum_override;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'a':
|
||||
output = createEmptyCib(1);
|
||||
@@ -355,7 +360,6 @@ main(int argc, char **argv)
|
||||
quiet = FALSE;
|
||||
}
|
||||
|
||||
- crm_log_init(NULL, LOG_CRIT, FALSE, FALSE, argc, argv, quiet);
|
||||
while (bump_log_num > 0) {
|
||||
crm_bump_log_level(argc, argv);
|
||||
bump_log_num--;
|
||||
diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c
|
||||
index c37b096..fc2f7c7 100644
|
||||
--- a/tools/crm_attribute.c
|
||||
+++ b/tools/crm_attribute.c
|
||||
@@ -146,11 +146,15 @@ main(int argc, char **argv)
|
||||
case '?':
|
||||
crm_help(flag, EX_OK);
|
||||
break;
|
||||
- case 'D':
|
||||
case 'G':
|
||||
+ command = flag;
|
||||
+ attr_value = optarg;
|
||||
+ break;
|
||||
+ case 'D':
|
||||
case 'v':
|
||||
command = flag;
|
||||
attr_value = optarg;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'q':
|
||||
case 'Q':
|
||||
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
||||
index 2a94362..1b2976b 100644
|
||||
--- a/tools/crm_resource.c
|
||||
+++ b/tools/crm_resource.c
|
||||
@@ -304,6 +304,7 @@ main(int argc, char **argv)
|
||||
|| safe_str_eq("force-check", longname)) {
|
||||
rsc_cmd = flag;
|
||||
rsc_long_cmd = longname;
|
||||
+ crm_log_args(argc, argv);
|
||||
|
||||
} else if (safe_str_eq("list-ocf-providers", longname)
|
||||
|| safe_str_eq("list-ocf-alternatives", longname)
|
||||
@@ -433,6 +434,7 @@ main(int argc, char **argv)
|
||||
break;
|
||||
case 'f':
|
||||
do_force = TRUE;
|
||||
+ crm_log_args(argc, argv);
|
||||
break;
|
||||
case 'i':
|
||||
prop_id = optarg;
|
||||
@@ -452,41 +454,55 @@ main(int argc, char **argv)
|
||||
case 'T':
|
||||
timeout_ms = crm_get_msec(optarg);
|
||||
break;
|
||||
+
|
||||
case 'C':
|
||||
case 'R':
|
||||
case 'P':
|
||||
- rsc_cmd = 'C';
|
||||
+ crm_log_args(argc, argv);
|
||||
require_resource = FALSE;
|
||||
require_crmd = TRUE;
|
||||
+ rsc_cmd = 'C';
|
||||
break;
|
||||
+
|
||||
case 'F':
|
||||
- rsc_cmd = flag;
|
||||
+ crm_log_args(argc, argv);
|
||||
require_crmd = TRUE;
|
||||
+ rsc_cmd = flag;
|
||||
+ break;
|
||||
+
|
||||
+ case 'U':
|
||||
+ case 'B':
|
||||
+ case 'M':
|
||||
+ case 'D':
|
||||
+ crm_log_args(argc, argv);
|
||||
+ rsc_cmd = flag;
|
||||
break;
|
||||
+
|
||||
case 'L':
|
||||
case 'c':
|
||||
case 'l':
|
||||
case 'q':
|
||||
case 'w':
|
||||
- case 'D':
|
||||
case 'W':
|
||||
- case 'M':
|
||||
- case 'U':
|
||||
- case 'B':
|
||||
case 'O':
|
||||
case 'o':
|
||||
case 'A':
|
||||
case 'a':
|
||||
rsc_cmd = flag;
|
||||
break;
|
||||
+
|
||||
case 'j':
|
||||
print_pending = TRUE;
|
||||
break;
|
||||
case 'p':
|
||||
- case 'g':
|
||||
case 'd':
|
||||
case 'S':
|
||||
+ crm_log_args(argc, argv);
|
||||
+ prop_name = optarg;
|
||||
+ rsc_cmd = flag;
|
||||
+ break;
|
||||
case 'G':
|
||||
+ case 'g':
|
||||
prop_name = optarg;
|
||||
rsc_cmd = flag;
|
||||
break;
|
46
0033-Feature-Tools-Do-not-send-command-lines-to-syslog.patch
Normal file
46
0033-Feature-Tools-Do-not-send-command-lines-to-syslog.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Mon, 28 Sep 2015 15:02:10 +1000
|
||||
Subject: [PATCH] Feature: Tools: Do not send command lines to syslog
|
||||
|
||||
(cherry picked from commit 8dae6838312c6a60c2e4b7ffa73a100fd5d0dce3)
|
||||
---
|
||||
lib/common/logging.c | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
diff --git a/lib/common/logging.c b/lib/common/logging.c
|
||||
index b18b841..6879023 100644
|
||||
--- a/lib/common/logging.c
|
||||
+++ b/lib/common/logging.c
|
||||
@@ -928,24 +928,17 @@ crm_log_args(int argc, char **argv)
|
||||
{
|
||||
int lpc = 0;
|
||||
int len = 0;
|
||||
- int restore = FALSE;
|
||||
int existing_len = 0;
|
||||
int line = __LINE__;
|
||||
static int logged = 0;
|
||||
|
||||
char *arg_string = NULL;
|
||||
- struct qb_log_callsite *args_cs =
|
||||
- qb_log_callsite_get(__func__, __FILE__, ARGS_FMT, LOG_NOTICE, line, 0);
|
||||
|
||||
if (argc == 0 || argv == NULL || logged) {
|
||||
return;
|
||||
}
|
||||
|
||||
logged = 1;
|
||||
- qb_bit_set(args_cs->targets, QB_LOG_SYSLOG); /* Turn on syslog too */
|
||||
-
|
||||
- restore = qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_STATE_GET, 0);
|
||||
- qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_TRUE);
|
||||
|
||||
for (; lpc < argc; lpc++) {
|
||||
if (argv[lpc] == NULL) {
|
||||
@@ -958,7 +951,6 @@ crm_log_args(int argc, char **argv)
|
||||
}
|
||||
|
||||
qb_log_from_external_source(__func__, __FILE__, ARGS_FMT, LOG_NOTICE, line, 0, arg_string);
|
||||
- qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, restore);
|
||||
|
||||
free(arg_string);
|
||||
}
|
21
0034-Log-cibadmin-Default-once-again-to-LOG_CRIT.patch
Normal file
21
0034-Log-cibadmin-Default-once-again-to-LOG_CRIT.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Mon, 28 Sep 2015 18:45:32 +1000
|
||||
Subject: [PATCH] Log: cibadmin: Default once again to LOG_CRIT
|
||||
|
||||
(cherry picked from commit d0d6118cbee3eccb3467058eadd91e08d3f4a42f)
|
||||
---
|
||||
tools/cibadmin.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/tools/cibadmin.c b/tools/cibadmin.c
|
||||
index c16d3c7..84531f8 100644
|
||||
--- a/tools/cibadmin.c
|
||||
+++ b/tools/cibadmin.c
|
||||
@@ -214,6 +214,7 @@ main(int argc, char **argv)
|
||||
|
||||
crm_xml_init(); /* Sets buffer allocation strategy */
|
||||
crm_log_cli_init("cibadmin");
|
||||
+ set_crm_log_level(LOG_CRIT);
|
||||
crm_set_options(NULL, "command [options] [data]", long_options,
|
||||
"Provides direct access to the cluster configuration."
|
||||
"\n\nAllows the configuration, or sections of it, to be queried, modified, replaced and deleted."
|
@ -0,0 +1,87 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Wed, 30 Sep 2015 17:33:00 +1000
|
||||
Subject: [PATCH] Fix: crm_resource: Correctly update existing meta attributes
|
||||
regardless of their position in the heirarchy
|
||||
|
||||
(cherry picked from commit f367348c832c64e2dc480dc96d2e0c2aa88639ba)
|
||||
|
||||
Conflicts:
|
||||
tools/crm_resource_runtime.c
|
||||
---
|
||||
tools/crm_resource_runtime.c | 44 ++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 36 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index ce9db01..a04adb9 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -213,10 +213,11 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
}
|
||||
|
||||
if (safe_str_eq(attr_set_type, XML_TAG_ATTR_SETS)) {
|
||||
- rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id, XML_TAG_META_SETS, attr_set, attr_id,
|
||||
- attr_name, &local_attr_id);
|
||||
- if(rc == pcmk_ok && do_force == FALSE) {
|
||||
- if (BE_QUIET == FALSE) {
|
||||
+ if (do_force == FALSE) {
|
||||
+ rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id,
|
||||
+ XML_TAG_META_SETS, attr_set, attr_id,
|
||||
+ attr_name, &local_attr_id);
|
||||
+ if (rc == pcmk_ok && BE_QUIET == FALSE) {
|
||||
printf("WARNING: There is already a meta attribute for '%s' called '%s' (id=%s)\n",
|
||||
uber_parent(rsc)->id, attr_name, local_attr_id);
|
||||
printf(" Delete '%s' first or use --force to override\n", local_attr_id);
|
||||
@@ -224,7 +225,7 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
return -ENOTUNIQ;
|
||||
}
|
||||
|
||||
- } else if(rsc->parent) {
|
||||
+ } else if(rsc->parent && do_force == FALSE) {
|
||||
|
||||
switch(rsc->parent->variant) {
|
||||
case pe_group:
|
||||
@@ -234,14 +235,41 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
break;
|
||||
case pe_master:
|
||||
case pe_clone:
|
||||
- rsc = rsc->parent;
|
||||
- if (BE_QUIET == FALSE) {
|
||||
- printf("Updating '%s' for '%s'...\n", rsc->id, rsc_id);
|
||||
+
|
||||
+ rc = find_resource_attr(cib, XML_ATTR_ID, rsc_id, attr_set_type, attr_set, attr_id, attr_name, &local_attr_id);
|
||||
+ free(local_attr_id);
|
||||
+
|
||||
+ if(rc != pcmk_ok) {
|
||||
+ rsc = rsc->parent;
|
||||
+ if (BE_QUIET == FALSE) {
|
||||
+ printf("Updating '%s' on '%s', the parent of '%s'\n", attr_name, rsc->id, rsc_id);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ } else if (rsc->parent && BE_QUIET == FALSE) {
|
||||
+ printf("Forcing update of '%s' for '%s' instead of '%s'\n", attr_name, rsc_id, rsc->parent->id);
|
||||
+
|
||||
+ } else if(rsc->parent == NULL && rsc->children) {
|
||||
+ resource_t *child = rsc->children->data;
|
||||
+
|
||||
+ if(child->variant == pe_native) {
|
||||
+ lookup_id = clone_strip(child->id); /* Could be a cloned group! */
|
||||
+ rc = find_resource_attr(cib, XML_ATTR_ID, lookup_id, attr_set_type, attr_set, attr_id, attr_name, &local_attr_id);
|
||||
+
|
||||
+ if(rc == pcmk_ok) {
|
||||
+ rsc = child;
|
||||
+ if (BE_QUIET == FALSE) {
|
||||
+ printf("A value for '%s' already exists in child '%s', updating that instead of '%s'\n", attr_name, lookup_id, rsc_id);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free(local_attr_id);
|
||||
+ free(lookup_id);
|
||||
+ }
|
||||
}
|
||||
|
||||
lookup_id = clone_strip(rsc->id); /* Could be a cloned group! */
|
@ -0,0 +1,27 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Mon, 5 Oct 2015 12:27:59 +1100
|
||||
Subject: [PATCH] Log: crm_resource --restart: Improved user feedback on
|
||||
failure
|
||||
|
||||
(cherry picked from commit b557a39973a1fb85b2791be67dc03cfd32c22d89)
|
||||
---
|
||||
tools/crm_resource_runtime.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index a04adb9..878fd0b 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -1040,6 +1040,12 @@ cli_resource_restart(resource_t * rsc, const char *host, int timeout_ms, cib_t *
|
||||
pe_working_set_t data_set;
|
||||
|
||||
if(resource_is_running_on(rsc, host) == FALSE) {
|
||||
+ const char *id = rsc->clone_name?rsc->clone_name:rsc->id;
|
||||
+ if(host) {
|
||||
+ printf("%s is not running on %s and so cannot be restarted\n", id, host);
|
||||
+ } else {
|
||||
+ printf("%s is not running anywhere and so cannot be restarted\n", id);
|
||||
+ }
|
||||
return -ENXIO;
|
||||
}
|
||||
|
179
0037-Fix-crm_resource-Correctly-delete-existing-meta-attr.patch
Normal file
179
0037-Fix-crm_resource-Correctly-delete-existing-meta-attr.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From: "Gao,Yan" <ygao@suse.com>
|
||||
Date: Wed, 30 Sep 2015 16:59:43 +0200
|
||||
Subject: [PATCH] Fix: crm_resource: Correctly delete existing meta attributes
|
||||
regardless of their position in the heirarchy
|
||||
|
||||
Use the same logics as "--set-parameter" for "--delete-parameter".
|
||||
|
||||
(cherry picked from commit cdee10c7310ab433b006126bc087f6b8dff3843e)
|
||||
|
||||
Conflicts:
|
||||
tools/crm_resource_runtime.c
|
||||
---
|
||||
tools/crm_resource_runtime.c | 109 ++++++++++++++++++++++---------------------
|
||||
1 file changed, 55 insertions(+), 54 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index 878fd0b..2d51e88 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -190,47 +190,20 @@ find_resource_attr(cib_t * the_cib, const char *attr, const char *rsc, const cha
|
||||
return rc;
|
||||
}
|
||||
|
||||
-int
|
||||
-cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const char *attr_id,
|
||||
- const char *attr_name, const char *attr_value, bool recursive,
|
||||
- cib_t * cib, pe_working_set_t * data_set)
|
||||
+static resource_t *
|
||||
+find_matching_attr_resource(resource_t * rsc, const char * rsc_id, const char * attr_set, const char * attr_id,
|
||||
+ const char * attr_name, cib_t * cib, const char * cmd)
|
||||
{
|
||||
int rc = pcmk_ok;
|
||||
- static bool need_init = TRUE;
|
||||
-
|
||||
char *lookup_id = NULL;
|
||||
char *local_attr_id = NULL;
|
||||
- char *local_attr_set = NULL;
|
||||
-
|
||||
- xmlNode *xml_top = NULL;
|
||||
- xmlNode *xml_obj = NULL;
|
||||
-
|
||||
- bool use_attributes_tag = FALSE;
|
||||
- resource_t *rsc = find_rsc_or_clone(rsc_id, data_set);
|
||||
-
|
||||
- if (rsc == NULL) {
|
||||
- return -ENXIO;
|
||||
- }
|
||||
-
|
||||
- if (safe_str_eq(attr_set_type, XML_TAG_ATTR_SETS)) {
|
||||
- if (do_force == FALSE) {
|
||||
- rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id,
|
||||
- XML_TAG_META_SETS, attr_set, attr_id,
|
||||
- attr_name, &local_attr_id);
|
||||
- if (rc == pcmk_ok && BE_QUIET == FALSE) {
|
||||
- printf("WARNING: There is already a meta attribute for '%s' called '%s' (id=%s)\n",
|
||||
- uber_parent(rsc)->id, attr_name, local_attr_id);
|
||||
- printf(" Delete '%s' first or use --force to override\n", local_attr_id);
|
||||
- }
|
||||
- return -ENOTUNIQ;
|
||||
- }
|
||||
|
||||
- } else if(rsc->parent && do_force == FALSE) {
|
||||
+ if(rsc->parent && do_force == FALSE) {
|
||||
|
||||
switch(rsc->parent->variant) {
|
||||
case pe_group:
|
||||
if (BE_QUIET == FALSE) {
|
||||
- printf("Updating '%s' for '%s' will not apply to its peers in '%s'\n", attr_name, rsc_id, rsc->parent->id);
|
||||
+ printf("Performing %s of '%s' for '%s' will not apply to its peers in '%s'\n", cmd, attr_name, rsc_id, rsc->parent->id);
|
||||
}
|
||||
break;
|
||||
case pe_master:
|
||||
@@ -242,7 +215,7 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
if(rc != pcmk_ok) {
|
||||
rsc = rsc->parent;
|
||||
if (BE_QUIET == FALSE) {
|
||||
- printf("Updating '%s' on '%s', the parent of '%s'\n", attr_name, rsc->id, rsc_id);
|
||||
+ printf("Performing %s of '%s' on '%s', the parent of '%s'\n", cmd, attr_name, rsc->id, rsc_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -251,7 +224,7 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
}
|
||||
|
||||
} else if (rsc->parent && BE_QUIET == FALSE) {
|
||||
- printf("Forcing update of '%s' for '%s' instead of '%s'\n", attr_name, rsc_id, rsc->parent->id);
|
||||
+ printf("Forcing %s of '%s' for '%s' instead of '%s'\n", cmd, attr_name, rsc_id, rsc->parent->id);
|
||||
|
||||
} else if(rsc->parent == NULL && rsc->children) {
|
||||
resource_t *child = rsc->children->data;
|
||||
@@ -263,7 +236,7 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
if(rc == pcmk_ok) {
|
||||
rsc = child;
|
||||
if (BE_QUIET == FALSE) {
|
||||
- printf("A value for '%s' already exists in child '%s', updating that instead of '%s'\n", attr_name, lookup_id, rsc_id);
|
||||
+ printf("A value for '%s' already exists in child '%s', performing %s on that instead of '%s'\n", attr_name, lookup_id, cmd, rsc_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,6 +245,51 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
}
|
||||
}
|
||||
|
||||
+ return rsc;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const char *attr_id,
|
||||
+ const char *attr_name, const char *attr_value, bool recursive,
|
||||
+ cib_t * cib, pe_working_set_t * data_set)
|
||||
+{
|
||||
+ int rc = pcmk_ok;
|
||||
+ static bool need_init = TRUE;
|
||||
+
|
||||
+ char *lookup_id = NULL;
|
||||
+ char *local_attr_id = NULL;
|
||||
+ char *local_attr_set = NULL;
|
||||
+
|
||||
+ xmlNode *xml_top = NULL;
|
||||
+ xmlNode *xml_obj = NULL;
|
||||
+
|
||||
+ bool use_attributes_tag = FALSE;
|
||||
+ resource_t *rsc = find_rsc_or_clone(rsc_id, data_set);
|
||||
+
|
||||
+ if (rsc == NULL) {
|
||||
+ return -ENXIO;
|
||||
+ }
|
||||
+
|
||||
+ if (safe_str_eq(attr_set_type, XML_TAG_ATTR_SETS)) {
|
||||
+ if (do_force == FALSE) {
|
||||
+ rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id,
|
||||
+ XML_TAG_META_SETS, attr_set, attr_id,
|
||||
+ attr_name, &local_attr_id);
|
||||
+ if (rc == pcmk_ok && BE_QUIET == FALSE) {
|
||||
+ printf("WARNING: There is already a meta attribute for '%s' called '%s' (id=%s)\n",
|
||||
+ uber_parent(rsc)->id, attr_name, local_attr_id);
|
||||
+ printf(" Delete '%s' first or use --force to override\n", local_attr_id);
|
||||
+ }
|
||||
+ free(local_attr_id);
|
||||
+ if (rc == pcmk_ok) {
|
||||
+ return -ENOTUNIQ;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ } else {
|
||||
+ rsc = find_matching_attr_resource(rsc, rsc_id, attr_set, attr_id, attr_name, cib, "update");
|
||||
+ }
|
||||
+
|
||||
lookup_id = clone_strip(rsc->id); /* Could be a cloned group! */
|
||||
rc = find_resource_attr(cib, XML_ATTR_ID, lookup_id, attr_set_type, attr_set, attr_id, attr_name,
|
||||
&local_attr_id);
|
||||
@@ -401,25 +419,8 @@ cli_resource_delete_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
- if(rsc->parent && safe_str_eq(attr_set_type, XML_TAG_META_SETS)) {
|
||||
-
|
||||
- switch(rsc->parent->variant) {
|
||||
- case pe_group:
|
||||
- if (BE_QUIET == FALSE) {
|
||||
- printf("Removing '%s' for '%s' will not apply to its peers in '%s'\n", attr_name, rsc_id, rsc->parent->id);
|
||||
- }
|
||||
- break;
|
||||
- case pe_master:
|
||||
- case pe_clone:
|
||||
- rsc = rsc->parent;
|
||||
- if (BE_QUIET == FALSE) {
|
||||
- printf("Removing '%s' from '%s' for '%s'...\n", attr_name, rsc->id, rsc_id);
|
||||
- }
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
+ if(safe_str_eq(attr_set_type, XML_TAG_META_SETS)) {
|
||||
+ rsc = find_matching_attr_resource(rsc, rsc_id, attr_set, attr_id, attr_name, cib, "delete");
|
||||
}
|
||||
|
||||
lookup_id = clone_strip(rsc->id);
|
@ -0,0 +1,75 @@
|
||||
From: Andrew Beekhof <andrew@beekhof.net>
|
||||
Date: Thu, 8 Oct 2015 13:38:07 +1100
|
||||
Subject: [PATCH] Fix: crm_resource: Correctly observe --force when deleting
|
||||
and updating attributes
|
||||
|
||||
(cherry picked from commit bd232e36403ea807635cabd336d8bb3101710891)
|
||||
---
|
||||
tools/crm_resource_runtime.c | 25 +++++++++++++++++++++----
|
||||
1 file changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
||||
index 2d51e88..c3f5275 100644
|
||||
--- a/tools/crm_resource_runtime.c
|
||||
+++ b/tools/crm_resource_runtime.c
|
||||
@@ -123,8 +123,9 @@ find_resource_attr(cib_t * the_cib, const char *attr, const char *rsc, const cha
|
||||
xmlNode *xml_search = NULL;
|
||||
char *xpath_string = NULL;
|
||||
|
||||
- CRM_ASSERT(value != NULL);
|
||||
- *value = NULL;
|
||||
+ if(value) {
|
||||
+ *value = NULL;
|
||||
+ }
|
||||
|
||||
if(the_cib == NULL) {
|
||||
return -ENOTCONN;
|
||||
@@ -176,7 +177,7 @@ find_resource_attr(cib_t * the_cib, const char *attr, const char *rsc, const cha
|
||||
crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child));
|
||||
}
|
||||
|
||||
- } else {
|
||||
+ } else if(value) {
|
||||
const char *tmp = crm_element_value(xml_search, attr);
|
||||
|
||||
if (tmp) {
|
||||
@@ -198,8 +199,10 @@ find_matching_attr_resource(resource_t * rsc, const char * rsc_id, const char *
|
||||
char *lookup_id = NULL;
|
||||
char *local_attr_id = NULL;
|
||||
|
||||
- if(rsc->parent && do_force == FALSE) {
|
||||
+ if(do_force == TRUE) {
|
||||
+ return rsc;
|
||||
|
||||
+ } else if(rsc->parent) {
|
||||
switch(rsc->parent->variant) {
|
||||
case pe_group:
|
||||
if (BE_QUIET == FALSE) {
|
||||
@@ -270,6 +273,13 @@ cli_resource_update_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
+ if(attr_id == NULL
|
||||
+ && do_force == FALSE
|
||||
+ && pcmk_ok != find_resource_attr(
|
||||
+ cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, NULL, NULL, attr_name, NULL)) {
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
if (safe_str_eq(attr_set_type, XML_TAG_ATTR_SETS)) {
|
||||
if (do_force == FALSE) {
|
||||
rc = find_resource_attr(cib, XML_ATTR_ID, uber_parent(rsc)->id,
|
||||
@@ -419,6 +429,13 @@ cli_resource_delete_attribute(const char *rsc_id, const char *attr_set, const ch
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
+ if(attr_id == NULL
|
||||
+ && do_force == FALSE
|
||||
+ && find_resource_attr(
|
||||
+ cib, XML_ATTR_ID, uber_parent(rsc)->id, NULL, NULL, NULL, attr_name, NULL) != pcmk_ok) {
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
if(safe_str_eq(attr_set_type, XML_TAG_META_SETS)) {
|
||||
rsc = find_matching_attr_resource(rsc, rsc_id, attr_set, attr_id, attr_name, cib, "delete");
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index be8261a..60fe8ed 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1681,6 +1681,7 @@ else
|
||||
-Wall
|
||||
-Waggregate-return
|
||||
-Wbad-function-cast
|
||||
+ -Wcast-align
|
||||
-Wdeclaration-after-statement
|
||||
-Wendif-labels
|
||||
-Wfloat-equal
|
5904
pacemaker-63f8e9a-rollup.patch
Normal file
5904
pacemaker-63f8e9a-rollup.patch
Normal file
File diff suppressed because it is too large
Load Diff
39349
pacemaker-781a388.patch
39349
pacemaker-781a388.patch
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
37184
pacemaker-d19719c.patch
37184
pacemaker-d19719c.patch
File diff suppressed because it is too large
Load Diff
@ -1,45 +0,0 @@
|
||||
diff --git a/mcp/corosync.c b/mcp/corosync.c
|
||||
index 07d7490..a4f6b34 100644
|
||||
--- a/mcp/corosync.c
|
||||
+++ b/mcp/corosync.c
|
||||
@@ -50,7 +50,6 @@ static struct cpg_name cpg_group = {
|
||||
gboolean use_cman = FALSE;
|
||||
static cpg_handle_t cpg_handle;
|
||||
static corosync_cfg_handle_t cfg_handle;
|
||||
-static corosync_cfg_state_notification_t cfg_buffer;
|
||||
|
||||
/* =::=::=::= CFG - Shutdown stuff =::=::=::= */
|
||||
|
||||
@@ -143,14 +142,6 @@ cluster_connect_cfg(uint32_t * nodeid)
|
||||
|
||||
crm_debug("Our nodeid: %d", *nodeid);
|
||||
|
||||
- retries = 0;
|
||||
- cs_repeat(retries, 30, rc = corosync_cfg_state_track(cfg_handle, 0, &cfg_buffer));
|
||||
-
|
||||
- if (rc != CS_OK) {
|
||||
- crm_err("corosync cfg stack_track error %d", rc);
|
||||
- goto bail;
|
||||
- }
|
||||
-
|
||||
crm_debug("Adding fd=%d to mainloop", fd);
|
||||
G_main_add_fd(G_PRIORITY_HIGH, fd, FALSE, pcmk_cfg_dispatch, &cfg_handle,
|
||||
cfg_connection_destroy);
|
||||
diff --git a/tools/report.collector b/tools/report.collector
|
||||
index 20203f6..4fdac3e 100644
|
||||
--- a/tools/report.collector
|
||||
+++ b/tools/report.collector
|
||||
@@ -700,10 +700,9 @@ for l in $logfiles $EXTRA_LOGS; do
|
||||
node_events `basename $l` > $EVENTS_F
|
||||
|
||||
# Link the first logfile to a standard name if it doesn't yet exist
|
||||
- if [ -e $HALOG_F ]; then
|
||||
- : nothing
|
||||
- else
|
||||
- ln -s `basename $l` $HALOG_F
|
||||
+ f=`basename $l`
|
||||
+ if [ -e $f -a ! -e $HALOG_F ]; then
|
||||
+ ln -s $f $HALOG_F
|
||||
fi
|
||||
done
|
||||
|
@ -1,23 +0,0 @@
|
||||
diff -r c6a01b02950b include/crm_config.h.in
|
||||
--- a/include/crm_config.h.in Sat Mar 19 10:50:21 2011 +0100
|
||||
+++ b/include/crm_config.h.in Fri Mar 25 18:34:59 2011 +0100
|
||||
@@ -36,9 +36,6 @@
|
||||
/* Where to keep CIB configuration files */
|
||||
#undef CRM_CONFIG_DIR
|
||||
|
||||
-/* Location for Pacemaker daemons */
|
||||
-#undef CRM_DAEMON_DIR
|
||||
-
|
||||
/* Group to run Pacemaker daemons as */
|
||||
#undef CRM_DAEMON_GROUP
|
||||
|
||||
@@ -69,9 +66,6 @@
|
||||
/* Compatability alias for SUPPORT_COROSYNC */
|
||||
#undef AIS_COROSYNC
|
||||
|
||||
-/* Correct printf format for logging uint64_t */
|
||||
-#undef U64T
|
||||
-
|
||||
/* Use g_hash_table compatibility functions */
|
||||
#undef USE_GHASH_COMPAT
|
||||
|
4919
pacemaker-rollup-3a7715d.patch
Normal file
4919
pacemaker-rollup-3a7715d.patch
Normal file
File diff suppressed because it is too large
Load Diff
7989
pacemaker-rollup-7-1-3d781d3.patch
Normal file
7989
pacemaker-rollup-7-1-3d781d3.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,665 +0,0 @@
|
||||
diff --git a/include/crm/common/logging.h b/include/crm/common/logging.h
|
||||
index 5b8e47f..642fa92 100644
|
||||
--- a/include/crm/common/logging.h
|
||||
+++ b/include/crm/common/logging.h
|
||||
@@ -157,7 +157,7 @@ unsigned int get_crm_log_level(void);
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
-# define do_crm_log_always(level, fmt, args...) qb_log(level, "%s: " fmt, __FUNCTION__ , ##args)
|
||||
+# define do_crm_log_always(level, fmt, args...) qb_log(level, fmt , ##args)
|
||||
|
||||
# define crm_perror(level, fmt, args...) do { \
|
||||
const char *err = strerror(errno); \
|
||||
diff --git a/include/crm/services.h b/include/crm/services.h
|
||||
index 5310709..1a02656 100644
|
||||
--- a/include/crm/services.h
|
||||
+++ b/include/crm/services.h
|
||||
@@ -262,8 +262,9 @@ enum nagios_exitcode {
|
||||
*/
|
||||
svc_action_t *services_action_create_generic(const char *exec, const char *args[]);
|
||||
|
||||
- void
|
||||
- services_action_free(svc_action_t * op);
|
||||
+ void services_action_cleanup(svc_action_t * op);
|
||||
+
|
||||
+ void services_action_free(svc_action_t * op);
|
||||
|
||||
gboolean services_action_sync(svc_action_t * op);
|
||||
|
||||
diff --git a/lib/cib/cib_utils.c b/lib/cib/cib_utils.c
|
||||
index 15b354b..ea37c4b 100644
|
||||
--- a/lib/cib/cib_utils.c
|
||||
+++ b/lib/cib/cib_utils.c
|
||||
@@ -112,8 +112,13 @@ get_cib_copy(cib_t * cib)
|
||||
{
|
||||
xmlNode *xml_cib;
|
||||
int options = cib_scope_local | cib_sync_call;
|
||||
- int rc = cib->cmds->query(cib, NULL, &xml_cib, options);
|
||||
+ int rc = pcmk_ok;
|
||||
+
|
||||
+ if (cib->state == cib_disconnected) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
+ rc = cib->cmds->query(cib, NULL, &xml_cib, options);
|
||||
if (rc == -EACCES) {
|
||||
return NULL;
|
||||
|
||||
diff --git a/lib/services/dbus.c b/lib/services/dbus.c
|
||||
index c0153b5..f44b590 100644
|
||||
--- a/lib/services/dbus.c
|
||||
+++ b/lib/services/dbus.c
|
||||
@@ -145,7 +145,7 @@ DBusMessage *pcmk_dbus_send_recv(DBusMessage *msg, DBusConnection *connection, D
|
||||
return reply;
|
||||
}
|
||||
|
||||
-bool pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
||||
+DBusPendingCall* pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
||||
void(*done)(DBusPendingCall *pending, void *user_data), void *user_data)
|
||||
{
|
||||
DBusError error;
|
||||
@@ -161,27 +161,30 @@ bool pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
||||
// send message and get a handle for a reply
|
||||
if (!dbus_connection_send_with_reply (connection, msg, &pending, -1/* aka. DBUS_TIMEOUT_USE_DEFAULT */)) { // -1 is default timeout
|
||||
crm_err("Send with reply failed for %s", method);
|
||||
- return FALSE;
|
||||
+ return NULL;
|
||||
|
||||
} else if (pending == NULL) {
|
||||
crm_err("No pending call found for %s", method);
|
||||
- return FALSE;
|
||||
-
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+ crm_trace("DBus %s call sent", method);
|
||||
if (dbus_pending_call_get_completed(pending)) {
|
||||
- crm_info("DBus %s call completed too soon");
|
||||
-#if 1
|
||||
+ crm_info("DBus %s call completed too soon", method);
|
||||
+ if(done) {
|
||||
+#if 0
|
||||
/* This sounds like a good idea, but allegedly it breaks things */
|
||||
done(pending, user_data);
|
||||
+ pending = NULL;
|
||||
#else
|
||||
CRM_ASSERT(dbus_pending_call_set_notify(pending, done, user_data, NULL));
|
||||
#endif
|
||||
+ }
|
||||
|
||||
- } else {
|
||||
+ } else if(done) {
|
||||
CRM_ASSERT(dbus_pending_call_set_notify(pending, done, user_data, NULL));
|
||||
}
|
||||
- return TRUE;
|
||||
+ return pending;
|
||||
}
|
||||
|
||||
bool pcmk_dbus_type_check(DBusMessage *msg, DBusMessageIter *field, int expected, const char *function, int line)
|
||||
@@ -286,6 +289,11 @@ pcmk_dbus_lookup_result(DBusMessage *reply, struct db_getall_data *data)
|
||||
dbus_message_iter_next (&dict);
|
||||
}
|
||||
|
||||
+ if(data->name && data->callback) {
|
||||
+ crm_trace("No value for property %s[%s]", data->object, data->name);
|
||||
+ data->callback(data->name, NULL, data->userdata);
|
||||
+ }
|
||||
+
|
||||
cleanup:
|
||||
free(data->target);
|
||||
free(data->object);
|
||||
@@ -306,6 +314,9 @@ pcmk_dbus_lookup_cb(DBusPendingCall *pending, void *user_data)
|
||||
|
||||
pcmk_dbus_lookup_result(reply, user_data);
|
||||
|
||||
+ if(pending) {
|
||||
+ dbus_pending_call_unref(pending);
|
||||
+ }
|
||||
if(reply) {
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
@@ -375,20 +386,59 @@ static void pcmk_dbus_connection_dispatch(DBusConnection *connection, DBusDispat
|
||||
crm_trace("status %d for %p", new_status, data);
|
||||
if (new_status == DBUS_DISPATCH_DATA_REMAINS){
|
||||
dbus_connection_dispatch(connection);
|
||||
+
|
||||
+ while (dbus_connection_get_dispatch_status(connection) == DBUS_DISPATCH_DATA_REMAINS) {
|
||||
+ dbus_connection_dispatch(connection);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+/* Copied from dbus-watch.c */
|
||||
+
|
||||
+static const char*
|
||||
+dbus_watch_flags_to_string (int flags)
|
||||
+{
|
||||
+ const char *watch_type;
|
||||
+
|
||||
+ if ((flags & DBUS_WATCH_READABLE) &&
|
||||
+ (flags & DBUS_WATCH_WRITABLE))
|
||||
+ watch_type = "readwrite";
|
||||
+ else if (flags & DBUS_WATCH_READABLE)
|
||||
+ watch_type = "read";
|
||||
+ else if (flags & DBUS_WATCH_WRITABLE)
|
||||
+ watch_type = "write";
|
||||
+ else
|
||||
+ watch_type = "not read or write";
|
||||
+ return watch_type;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
pcmk_dbus_watch_dispatch(gpointer userdata)
|
||||
{
|
||||
+ bool oom = FALSE;
|
||||
DBusWatch *watch = userdata;
|
||||
int flags = dbus_watch_get_flags(watch);
|
||||
+ bool enabled = dbus_watch_get_enabled (watch);
|
||||
+ mainloop_io_t *client = dbus_watch_get_data(watch);
|
||||
|
||||
- crm_trace("Dispatching %p with flags %d", watch, flags);
|
||||
- if(flags & DBUS_WATCH_READABLE) {
|
||||
- dbus_watch_handle(watch, DBUS_WATCH_READABLE);
|
||||
- } else {
|
||||
- dbus_watch_handle(watch, DBUS_WATCH_ERROR);
|
||||
+ crm_trace("Dispatching client %p: %s", client, dbus_watch_flags_to_string(flags));
|
||||
+ if (enabled && is_set(flags, DBUS_WATCH_READABLE)) {
|
||||
+ oom = !dbus_watch_handle(watch, flags);
|
||||
+
|
||||
+ } else if (enabled && is_set(flags, DBUS_WATCH_READABLE)) {
|
||||
+ oom = !dbus_watch_handle(watch, flags);
|
||||
+
|
||||
+ } else if(enabled) {
|
||||
+ oom = !dbus_watch_handle(watch, DBUS_WATCH_ERROR);
|
||||
+ }
|
||||
+
|
||||
+ if(flags != dbus_watch_get_flags(watch)) {
|
||||
+ flags = dbus_watch_get_flags(watch);
|
||||
+ crm_trace("Dispatched client %p: %s (%d)", client, dbus_watch_flags_to_string(flags), flags);
|
||||
+ }
|
||||
+
|
||||
+ if(oom) {
|
||||
+ crm_err("DBus encountered OOM while attempting to dispatch %p (%s)", client, dbus_watch_flags_to_string(flags));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -396,7 +446,8 @@ pcmk_dbus_watch_dispatch(gpointer userdata)
|
||||
static void
|
||||
pcmk_dbus_watch_destroy(gpointer userdata)
|
||||
{
|
||||
- crm_trace("Destroyed %p", userdata);
|
||||
+ mainloop_io_t *client = dbus_watch_get_data(userdata);
|
||||
+ crm_trace("Destroyed %p", client);
|
||||
}
|
||||
|
||||
|
||||
@@ -412,7 +463,7 @@ pcmk_dbus_watch_add(DBusWatch *watch, void *data){
|
||||
mainloop_io_t *client = mainloop_add_fd(
|
||||
"dbus", G_PRIORITY_DEFAULT, fd, watch, &pcmk_dbus_cb);
|
||||
|
||||
- crm_trace("Added %p with fd=%d", watch, fd);
|
||||
+ crm_trace("Added watch %p with fd=%d to client %p", watch, fd, client);
|
||||
dbus_watch_set_data(watch, client, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -429,14 +480,14 @@ static void
|
||||
pcmk_dbus_watch_remove(DBusWatch *watch, void *data){
|
||||
mainloop_io_t *client = dbus_watch_get_data(watch);
|
||||
|
||||
- crm_trace("Removed %p", watch);
|
||||
+ crm_trace("Removed client %p (%p)", client, data);
|
||||
mainloop_del_fd(client);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pcmk_dbus_timeout_dispatch(gpointer data)
|
||||
{
|
||||
- crm_trace("Timeout for %p");
|
||||
+ crm_info("Timeout %p expired", data);
|
||||
dbus_timeout_handle(data);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -445,6 +496,8 @@ static dbus_bool_t
|
||||
pcmk_dbus_timeout_add(DBusTimeout *timeout, void *data){
|
||||
guint id = g_timeout_add(dbus_timeout_get_interval(timeout), pcmk_dbus_timeout_dispatch, timeout);
|
||||
|
||||
+ crm_trace("Adding timeout %p (%ld)", timeout, dbus_timeout_get_interval(timeout));
|
||||
+
|
||||
if(id) {
|
||||
dbus_timeout_set_data(timeout, GUINT_TO_POINTER(id), NULL);
|
||||
}
|
||||
@@ -456,6 +509,8 @@ pcmk_dbus_timeout_remove(DBusTimeout *timeout, void *data){
|
||||
void *vid = dbus_timeout_get_data(timeout);
|
||||
guint id = GPOINTER_TO_UINT(vid);
|
||||
|
||||
+ crm_trace("Removing timeout %p (%p)", timeout, data);
|
||||
+
|
||||
if(id) {
|
||||
g_source_remove(id);
|
||||
dbus_timeout_set_data(timeout, 0, NULL);
|
||||
@@ -464,7 +519,11 @@ pcmk_dbus_timeout_remove(DBusTimeout *timeout, void *data){
|
||||
|
||||
static void
|
||||
pcmk_dbus_timeout_toggle(DBusTimeout *timeout, void *data){
|
||||
- if(dbus_timeout_get_enabled(timeout)) {
|
||||
+ bool enabled = dbus_timeout_get_enabled(timeout);
|
||||
+
|
||||
+ crm_trace("Toggling timeout for %p to %s", timeout, enabled?"off":"on");
|
||||
+
|
||||
+ if(enabled) {
|
||||
pcmk_dbus_timeout_add(timeout, data);
|
||||
} else {
|
||||
pcmk_dbus_timeout_remove(timeout, data);
|
||||
diff --git a/lib/services/pcmk-dbus.h b/lib/services/pcmk-dbus.h
|
||||
index ed80c5f..468020e 100644
|
||||
--- a/lib/services/pcmk-dbus.h
|
||||
+++ b/lib/services/pcmk-dbus.h
|
||||
@@ -2,7 +2,7 @@ DBusConnection *pcmk_dbus_connect(void);
|
||||
void pcmk_dbus_connection_setup_with_select(DBusConnection *c);
|
||||
void pcmk_dbus_disconnect(DBusConnection *connection);
|
||||
|
||||
-bool pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
||||
+DBusPendingCall *pcmk_dbus_send(DBusMessage *msg, DBusConnection *connection,
|
||||
void(*done)(DBusPendingCall *pending, void *user_data), void *user_data);
|
||||
DBusMessage *pcmk_dbus_send_recv(DBusMessage *msg, DBusConnection *connection, DBusError *error);
|
||||
bool pcmk_dbus_type_check(DBusMessage *msg, DBusMessageIter *field, int expected, const char *function, int line);
|
||||
diff --git a/lib/services/services.c b/lib/services/services.c
|
||||
index 9936c72..582fbe1 100644
|
||||
--- a/lib/services/services.c
|
||||
+++ b/lib/services/services.c
|
||||
@@ -303,18 +303,24 @@ services_action_create_generic(const char *exec, const char *args[])
|
||||
}
|
||||
|
||||
void
|
||||
-services_action_free(svc_action_t * op)
|
||||
+services_action_cleanup(svc_action_t * op)
|
||||
{
|
||||
- unsigned int i;
|
||||
-
|
||||
- if (op == NULL) {
|
||||
- return;
|
||||
+ if(op->opaque->timerid != 0) {
|
||||
+ crm_trace("Removing timer for call %s to %s", op->action, op->rsc);
|
||||
+ g_source_remove(op->opaque->timerid);
|
||||
+ op->opaque->timerid = 0;
|
||||
}
|
||||
|
||||
- if (op->opaque->repeat_timer) {
|
||||
- g_source_remove(op->opaque->repeat_timer);
|
||||
- op->opaque->repeat_timer = 0;
|
||||
+ if(op->opaque->pending) {
|
||||
+ crm_trace("Cleaning up pending dbus call %p %s for %s", op->opaque->pending, op->action, op->rsc);
|
||||
+ if(dbus_pending_call_get_completed(op->opaque->pending)) {
|
||||
+ crm_warn("Pending dbus call %s for %s did not complete", op->action, op->rsc);
|
||||
+ }
|
||||
+ dbus_pending_call_cancel(op->opaque->pending);
|
||||
+ dbus_pending_call_unref(op->opaque->pending);
|
||||
+ op->opaque->pending = NULL;
|
||||
}
|
||||
+
|
||||
if (op->opaque->stderr_gsource) {
|
||||
mainloop_del_fd(op->opaque->stderr_gsource);
|
||||
op->opaque->stderr_gsource = NULL;
|
||||
@@ -324,6 +330,23 @@ services_action_free(svc_action_t * op)
|
||||
mainloop_del_fd(op->opaque->stdout_gsource);
|
||||
op->opaque->stdout_gsource = NULL;
|
||||
}
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+services_action_free(svc_action_t * op)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ if (op == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ services_action_cleanup(op);
|
||||
+
|
||||
+ if (op->opaque->repeat_timer) {
|
||||
+ g_source_remove(op->opaque->repeat_timer);
|
||||
+ op->opaque->repeat_timer = 0;
|
||||
+ }
|
||||
|
||||
free(op->id);
|
||||
free(op->opaque->exec);
|
||||
diff --git a/lib/services/services_linux.c b/lib/services/services_linux.c
|
||||
index 2279e4e..8d6f450 100644
|
||||
--- a/lib/services/services_linux.c
|
||||
+++ b/lib/services/services_linux.c
|
||||
@@ -264,6 +264,8 @@ operation_finalize(svc_action_t * op)
|
||||
services_action_free(op);
|
||||
return TRUE;
|
||||
}
|
||||
+
|
||||
+ services_action_cleanup(op);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
diff --git a/lib/services/services_private.h b/lib/services/services_private.h
|
||||
index dd759e3..bcf882c 100644
|
||||
--- a/lib/services/services_private.h
|
||||
+++ b/lib/services/services_private.h
|
||||
@@ -19,6 +19,10 @@
|
||||
#ifndef __MH_SERVICES_PRIVATE_H__
|
||||
# define __MH_SERVICES_PRIVATE_H__
|
||||
|
||||
+#if SUPPORT_DBUS
|
||||
+# include <dbus/dbus.h>
|
||||
+#endif
|
||||
+
|
||||
struct svc_action_private_s {
|
||||
char *exec;
|
||||
char *args[255];
|
||||
@@ -31,6 +35,10 @@ struct svc_action_private_s {
|
||||
|
||||
int stdout_fd;
|
||||
mainloop_io_t *stdout_gsource;
|
||||
+#if SUPPORT_DBUS
|
||||
+ DBusPendingCall* pending;
|
||||
+ unsigned timerid;
|
||||
+#endif
|
||||
};
|
||||
|
||||
GList *services_os_get_directory_list(const char *root, gboolean files, gboolean executable);
|
||||
diff --git a/lib/services/systemd.c b/lib/services/systemd.c
|
||||
index 9a7b078..51ade44 100644
|
||||
--- a/lib/services/systemd.c
|
||||
+++ b/lib/services/systemd.c
|
||||
@@ -110,20 +110,48 @@ systemd_service_name(const char *name)
|
||||
return g_strdup_printf("%s.service", name);
|
||||
}
|
||||
|
||||
-static bool
|
||||
-systemd_daemon_reload(void)
|
||||
+static void
|
||||
+systemd_daemon_reload_complete(DBusPendingCall *pending, void *user_data)
|
||||
{
|
||||
- /* TODO: Make this asynchronous */
|
||||
- const char *method = "Reload";
|
||||
+ DBusError error;
|
||||
DBusMessage *reply = NULL;
|
||||
- DBusMessage *msg = systemd_new_method(BUS_NAME".Manager", method);
|
||||
+ unsigned int reload_count = GPOINTER_TO_UINT(user_data);
|
||||
|
||||
- CRM_ASSERT(msg != NULL);
|
||||
- reply = pcmk_dbus_send_recv(msg, systemd_proxy, NULL);
|
||||
- dbus_message_unref(msg);
|
||||
+ dbus_error_init(&error);
|
||||
+ if(pending) {
|
||||
+ reply = dbus_pending_call_steal_reply(pending);
|
||||
+ }
|
||||
+
|
||||
+ if(pcmk_dbus_find_error("Reload", pending, reply, &error)) {
|
||||
+ crm_err("Could not issue systemd reload %d: %s", reload_count, error.message);
|
||||
+
|
||||
+ } else {
|
||||
+ crm_trace("Reload %d complete", reload_count);
|
||||
+ }
|
||||
+
|
||||
+ if(pending) {
|
||||
+ dbus_pending_call_unref(pending);
|
||||
+ }
|
||||
if(reply) {
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+systemd_daemon_reload(void)
|
||||
+{
|
||||
+ static unsigned int reload_count = 0;
|
||||
+ const char *method = "Reload";
|
||||
+
|
||||
+
|
||||
+ reload_count++;
|
||||
+ if(reload_count % 10 == 0) {
|
||||
+ DBusMessage *msg = systemd_new_method(BUS_NAME".Manager", method);
|
||||
+
|
||||
+ CRM_ASSERT(msg != NULL);
|
||||
+ pcmk_dbus_send(msg, systemd_proxy, systemd_daemon_reload_complete, GUINT_TO_POINTER(reload_count));
|
||||
+ dbus_message_unref(msg);
|
||||
+ }
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -155,13 +183,22 @@ static void
|
||||
systemd_loadunit_cb(DBusPendingCall *pending, void *user_data)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
+ svc_action_t * op = user_data;
|
||||
|
||||
if(pending) {
|
||||
reply = dbus_pending_call_steal_reply(pending);
|
||||
}
|
||||
|
||||
+ if(op) {
|
||||
+ crm_trace("Got result: %p for %p for %s, %s", reply, pending, op->rsc, op->action);
|
||||
+ } else {
|
||||
+ crm_trace("Got result: %p for %p", reply, pending);
|
||||
+ }
|
||||
systemd_loadunit_result(reply, user_data);
|
||||
|
||||
+ if(pending) {
|
||||
+ dbus_pending_call_unref(pending);
|
||||
+ }
|
||||
if(reply) {
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
@@ -213,6 +250,7 @@ systemd_unit_by_name(const gchar * arg_name, svc_action_t *op)
|
||||
}
|
||||
|
||||
pcmk_dbus_send(msg, systemd_proxy, systemd_loadunit_cb, op);
|
||||
+ dbus_message_unref(msg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -421,6 +459,12 @@ systemd_async_dispatch(DBusPendingCall *pending, void *user_data)
|
||||
reply = dbus_pending_call_steal_reply(pending);
|
||||
}
|
||||
|
||||
+ if(op) {
|
||||
+ crm_trace("Got result: %p for %p for %s, %s", reply, pending, op->rsc, op->action);
|
||||
+ } else {
|
||||
+ crm_trace("Got result: %p for %p", reply, pending);
|
||||
+ }
|
||||
+ op->opaque->pending = NULL;
|
||||
systemd_exec_result(reply, op);
|
||||
|
||||
if(pending) {
|
||||
@@ -437,10 +481,13 @@ static void
|
||||
systemd_unit_check(const char *name, const char *state, void *userdata)
|
||||
{
|
||||
svc_action_t * op = userdata;
|
||||
-
|
||||
- CRM_ASSERT(state != NULL);
|
||||
|
||||
- if (g_strcmp0(state, "active") == 0) {
|
||||
+ crm_trace("Resource %s has %s='%s'", op->rsc, name, state);
|
||||
+
|
||||
+ if(state == NULL) {
|
||||
+ op->rc = PCMK_OCF_NOT_RUNNING;
|
||||
+
|
||||
+ } else if (g_strcmp0(state, "active") == 0) {
|
||||
op->rc = PCMK_OCF_OK;
|
||||
} else if (g_strcmp0(state, "activating") == 0) {
|
||||
op->rc = PCMK_OCF_PENDING;
|
||||
@@ -449,6 +496,7 @@ systemd_unit_check(const char *name, const char *state, void *userdata)
|
||||
}
|
||||
|
||||
if (op->synchronous == FALSE) {
|
||||
+ op->opaque->pending = NULL;
|
||||
operation_finalize(op);
|
||||
}
|
||||
}
|
||||
@@ -539,28 +587,29 @@ systemd_unit_exec_with_unit(svc_action_t * op, const char *unit)
|
||||
}
|
||||
|
||||
if (op->synchronous == FALSE) {
|
||||
- return pcmk_dbus_send(msg, systemd_proxy, systemd_async_dispatch, op);
|
||||
+ DBusPendingCall* pending = pcmk_dbus_send(msg, systemd_proxy, systemd_async_dispatch, op);
|
||||
+
|
||||
+ dbus_message_unref(msg);
|
||||
+ if(pending) {
|
||||
+ dbus_pending_call_ref(pending);
|
||||
+ op->opaque->pending = pending;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
|
||||
} else {
|
||||
DBusError error;
|
||||
|
||||
reply = pcmk_dbus_send_recv(msg, systemd_proxy, &error);
|
||||
+ dbus_message_unref(msg);
|
||||
systemd_exec_result(reply, op);
|
||||
|
||||
if(reply) {
|
||||
dbus_message_unref(reply);
|
||||
}
|
||||
- if(msg) {
|
||||
- dbus_message_unref(msg);
|
||||
- }
|
||||
-
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- if(msg) {
|
||||
- dbus_message_unref(msg);
|
||||
- }
|
||||
-
|
||||
cleanup:
|
||||
if (op->synchronous == FALSE) {
|
||||
operation_finalize(op);
|
||||
@@ -570,6 +619,18 @@ systemd_unit_exec_with_unit(svc_action_t * op, const char *unit)
|
||||
return op->rc == PCMK_OCF_OK;
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+systemd_timeout_callback(gpointer p)
|
||||
+{
|
||||
+ svc_action_t * op = p;
|
||||
+
|
||||
+ op->opaque->timerid = 0;
|
||||
+ crm_warn("%s operation on systemd unit %s named '%s' timed out", op->action, op->agent, op->rsc);
|
||||
+ operation_finalize(op);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
gboolean
|
||||
systemd_unit_exec(svc_action_t * op)
|
||||
{
|
||||
@@ -596,6 +657,7 @@ systemd_unit_exec(svc_action_t * op)
|
||||
free(unit);
|
||||
|
||||
if (op->synchronous == FALSE) {
|
||||
+ op->opaque->timerid = g_timeout_add(op->timeout + 5000, systemd_timeout_callback, op);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
diff --git a/lib/services/upstart.c b/lib/services/upstart.c
|
||||
index 4c7211d..01ff817 100644
|
||||
--- a/lib/services/upstart.c
|
||||
+++ b/lib/services/upstart.c
|
||||
@@ -513,8 +513,15 @@ upstart_job_exec(svc_action_t * op, gboolean synchronous)
|
||||
CRM_LOG_ASSERT(dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &arg_wait, DBUS_TYPE_INVALID));
|
||||
|
||||
if (op->synchronous == FALSE) {
|
||||
+ DBusPendingCall* pending = pcmk_dbus_send(msg, upstart_proxy, upstart_async_dispatch, op);
|
||||
free(job);
|
||||
- return pcmk_dbus_send(msg, upstart_proxy, upstart_async_dispatch, op);
|
||||
+
|
||||
+ if(pending) {
|
||||
+ dbus_pending_call_ref(pending);
|
||||
+ op->opaque->pending = pending;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ return FALSE;
|
||||
}
|
||||
|
||||
dbus_error_init(&error);
|
||||
diff --git a/lrmd/regression.py.in b/lrmd/regression.py.in
|
||||
index a9a32ef..649c984 100755
|
||||
--- a/lrmd/regression.py.in
|
||||
+++ b/lrmd/regression.py.in
|
||||
@@ -27,12 +27,12 @@ build_dir="@abs_top_builddir@"
|
||||
test_dir=sys.path[0]
|
||||
|
||||
new_path=os.environ['PATH']
|
||||
-
|
||||
if os.path.exists("%s/regression.py.in" % test_dir):
|
||||
print "Running tests from the source tree: %s (%s)" % (build_dir, test_dir)
|
||||
new_path = "%s/lrmd:%s" % (build_dir, new_path) # For lrmd, lrmd_test and pacemaker_remoted
|
||||
new_path = "%s/tools:%s" % (build_dir, new_path) # For crm_resource
|
||||
new_path = "%s/fencing:%s" % (build_dir, new_path) # For stonithd
|
||||
+
|
||||
else:
|
||||
print "Running tests from the install tree: @CRM_DAEMON_DIR@ (not %s)" % test_dir
|
||||
new_path = "@CRM_DAEMON_DIR@:%s" % (new_path) # For stonithd, lrmd, lrmd_test and pacemaker_remoted
|
||||
@@ -434,13 +434,15 @@ if __name__ == "__main__":
|
||||
for ra in [ "Dummy", "Stateful", "ping" ]:
|
||||
os.system("cp %s/extra/resources/%s @OCF_RA_DIR@/pacemaker/%s" % (build_dir, ra, ra))
|
||||
os.system("chmod a+x @OCF_RA_DIR@/pacemaker/%s" % (ra))
|
||||
- else:
|
||||
- # Assume it's installed
|
||||
- print "Using @datadir@/@PACKAGE@/tests/cts/LSBDummy"
|
||||
- os.system("cp @datadir@/@PACKAGE@/tests/cts/LSBDummy /etc/init.d/LSBDummy")
|
||||
|
||||
- os.system("chmod a+x /etc/init.d/LSBDummy")
|
||||
- os.system("ls -al /etc/init.d/LSBDummy")
|
||||
+ else:
|
||||
+ # Assume it's installed
|
||||
+ print "Using @datadir@/@PACKAGE@/tests/cts/LSBDummy"
|
||||
+ os.system("cp @datadir@/@PACKAGE@/tests/cts/LSBDummy /etc/init.d/LSBDummy")
|
||||
+
|
||||
+ os.system("chmod a+x /etc/init.d/LSBDummy")
|
||||
+ os.system("ls -al /etc/init.d/LSBDummy")
|
||||
+
|
||||
os.system("mkdir -p @CRM_CORE_DIR@/root")
|
||||
|
||||
if os.path.exists("/bin/systemctl"):
|
||||
@@ -747,6 +749,33 @@ if __name__ == "__main__":
|
||||
test.add_cmd("-c unregister_rsc -r \"test_rsc\" "+self.action_timeout+
|
||||
"-l \"NEW_EVENT event_type:unregister rsc_id:test_rsc action:none rc:ok op_status:complete\" ")
|
||||
|
||||
+ ### stress tests ###
|
||||
+ def build_stress_tests(self):
|
||||
+ timeout = "-t 20000"
|
||||
+ iterations = 25
|
||||
+
|
||||
+ test = self.new_test("ocf_stress", "Verify systemd dbus connection works under load")
|
||||
+ for i in range(iterations):
|
||||
+ test.add_cmd("-c register_rsc -r rsc_%s %s -C ocf -P heartbeat -T Dummy -l \"NEW_EVENT event_type:register rsc_id:rsc_%s action:none rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a start %s -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:start rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a monitor %s -i 1000 -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:monitor rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ for i in range(iterations):
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a stop %s -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:stop rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c unregister_rsc -r rsc_%s %s -l \"NEW_EVENT event_type:unregister rsc_id:rsc_%s action:none rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+
|
||||
+
|
||||
+ if "systemd" in self.rsc_classes:
|
||||
+ test = self.new_test("systemd_stress", "Verify systemd dbus connection works under load")
|
||||
+ for i in range(iterations):
|
||||
+ test.add_cmd("-c register_rsc -r rsc_%s %s -C systemd -T lrmd_dummy_daemon -l \"NEW_EVENT event_type:register rsc_id:rsc_%s action:none rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a start %s -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:start rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a monitor %s -i 1000 -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:monitor rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+
|
||||
+ for i in range(iterations):
|
||||
+ test.add_cmd("-c exec -r rsc_%s -a stop %s -l \"NEW_EVENT event_type:exec_complete rsc_id:rsc_%s action:stop rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+ test.add_cmd("-c unregister_rsc -r rsc_%s %s -l \"NEW_EVENT event_type:unregister rsc_id:rsc_%s action:none rc:ok op_status:complete\"" % (i, timeout, i))
|
||||
+
|
||||
+
|
||||
### These are tests that target specific cases ###
|
||||
def build_custom_tests(self):
|
||||
|
||||
@@ -1016,6 +1045,7 @@ def main(argv):
|
||||
tests.build_multi_rsc_tests()
|
||||
tests.build_negative_tests()
|
||||
tests.build_custom_tests()
|
||||
+ tests.build_stress_tests()
|
||||
|
||||
tests.setup_test_environment()
|
||||
|
@ -2,11 +2,14 @@
|
||||
%global uname hacluster
|
||||
%global pcmk_docdir %{_docdir}/%{name}
|
||||
|
||||
%global specversion 2.rev14
|
||||
%global commit 6052cd16c2f455809f8088af76ce86483bf98353
|
||||
%global specversion 3
|
||||
%global commit 44eb2ddf8d4f8fc05256aae2abc9fbf3ae4d1fbc
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
%global github_owner ClusterLabs
|
||||
|
||||
%global nagios_name nagios-agents-metadata
|
||||
%global nagios_hash 105ab8a7b2c16b9a29cf1c1596b80136eeef332b
|
||||
|
||||
# Turn off the auto compilation of python files not in the site-packages directory
|
||||
# Needed so that the -devel package is multilib compliant
|
||||
# py_auto_byte_compile macro: https://bugzilla.redhat.com/574437
|
||||
@ -59,7 +62,47 @@ License: GPLv2+ and LGPLv2+
|
||||
Url: http://www.clusterlabs.org
|
||||
Group: System Environment/Daemons
|
||||
|
||||
# eg. https://github.com/ClusterLabs/pacemaker/archive/8ae45302394b039fb098e150f156df29fc0cb576/pacemaker-8ae45302394b039fb098e150f156df29fc0cb576.tar.gz
|
||||
Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
|
||||
Source1: https://github.com/%{github_owner}/%{nagios_name}/archive/%{nagios_hash}/%{nagios_name}-%{nagios_hash}.tar.gz
|
||||
Patch1: pacemaker-63f8e9a-rollup.patch
|
||||
Patch2: pacemaker-rollup-7-1-3d781d3.patch
|
||||
Patch3: pacemaker-rollup-3a7715d.patch
|
||||
Patch4: 0004-Fix-crm_resource-Correctly-check-if-a-resource-is-un.patch
|
||||
Patch5: 0005-Fix-PE-Bug-cl-5247-Imply-resources-running-on-a-cont.patch
|
||||
Patch6: 0006-Fix-Date-Correctly-set-time-from-seconds-since-epoch.patch
|
||||
Patch7: 0007-Test-PE-Bug-cl-5247-Imply-resources-running-on-a-con.patch
|
||||
Patch8: 0008-Fix-tools-memory-leak-in-crm_resource.patch
|
||||
Patch9: 0009-Fix-pengine-The-failed-action-of-the-resource-that-o.patch
|
||||
Patch10: 0010-Log-services-Reduce-severity-of-noisy-log-messages.patch
|
||||
Patch11: 0011-Fix-xml-Mark-xml-nodes-as-dirty-if-any-children-move.patch
|
||||
Patch12: 0012-Feature-crmd-Implement-reliable-event-notifications.patch
|
||||
Patch13: 0013-Fix-cman-Suppress-implied-node-names.patch
|
||||
Patch14: 0014-Fix-crmd-Choose-more-appropriate-names-for-notificat.patch
|
||||
Patch15: 0015-Fix-crmd-Correctly-enable-disable-notifications.patch
|
||||
Patch16: 0016-Fix-crmd-Report-the-completion-status-and-output-of-.patch
|
||||
Patch17: 0017-Fix-cman-Print-the-nodeid-of-nodes-with-fake-names.patch
|
||||
Patch18: 0018-Refactor-Tools-Isolate-the-paths-which-truely-requir.patch
|
||||
Patch19: 0019-Fix-corosync-Display-node-state-and-quorum-data-if-a.patch
|
||||
Patch20: 0020-Fix-pacemakerd-Do-not-forget-about-nodes-that-leave-.patch
|
||||
Patch21: 0021-Fix-pacemakerd-Track-node-state-in-pacemakerd.patch
|
||||
Patch22: 0022-Fix-PE-Resolve-memory-leak.patch
|
||||
Patch23: 0023-Fix-cman-Purge-all-node-caches-for-crm_node-R.patch
|
||||
Patch24: 0024-Refactor-membership-Safely-autoreap-nodes-without-co.patch
|
||||
Patch25: 0025-Fix-crmd-Prevent-segfault-by-correctly-detecting-whe.patch
|
||||
Patch26: 0026-Fix-crmd-don-t-add-node-ID-to-proxied-remote-node-re.patch
|
||||
Patch27: 0027-Fix-pacemaker_remote-memory-leak-in-ipc_proxy_dispat.patch
|
||||
Patch28: 0028-Log-The-package-version-is-more-informative.patch
|
||||
Patch29: 0029-Fix-crm_resource-Allow-the-resource-configuration-to.patch
|
||||
Patch30: 0030-Log-lrmd-Improved-logging-when-no-pacemaker-remote-a.patch
|
||||
Patch31: 0031-Fix-liblrmd-don-t-print-error-if-remote-key-environm.patch
|
||||
Patch32: 0032-Fix-Tools-Repair-the-logging-of-interesting-command-.patch
|
||||
Patch33: 0033-Feature-Tools-Do-not-send-command-lines-to-syslog.patch
|
||||
Patch34: 0034-Log-cibadmin-Default-once-again-to-LOG_CRIT.patch
|
||||
Patch35: 0035-Fix-crm_resource-Correctly-update-existing-meta-attr.patch
|
||||
Patch36: 0036-Log-crm_resource-restart-Improved-user-feedback-on-f.patch
|
||||
Patch37: 0037-Fix-crm_resource-Correctly-delete-existing-meta-attr.patch
|
||||
Patch38: 0038-Fix-crm_resource-Correctly-observe-force-when-deleti.patch
|
||||
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
AutoReqProv: on
|
||||
@ -69,6 +112,7 @@ Requires: resource-agents
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
Requires: %{name}-cluster-libs = %{version}-%{release}
|
||||
Requires: %{name}-cli = %{version}-%{release}
|
||||
Provides: pcmk-cluster-manager
|
||||
|
||||
%if %{defined systemd_requires}
|
||||
%systemd_requires
|
||||
@ -169,6 +213,7 @@ Group: System Environment/Daemons
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
Requires: %{name}-cli = %{version}-%{release}
|
||||
Requires: resource-agents
|
||||
Provides: pcmk-cluster-manager
|
||||
%if %{defined systemd_requires}
|
||||
%systemd_requires
|
||||
%endif
|
||||
@ -220,8 +265,26 @@ Documentation for Pacemaker.
|
||||
Pacemaker is an advanced, scalable High-Availability cluster resource
|
||||
manager for Corosync, CMAN and/or Linux-HA.
|
||||
|
||||
%package nagios-plugins-metadata
|
||||
License: GPLv2+ and LGPLv2+
|
||||
Summary: Pacemaker Nagios Metadata
|
||||
Group: System Environment/Daemons
|
||||
# NOTE below are the plugins this metadata uses.
|
||||
Requires: nagios-plugins-http
|
||||
Requires: nagios-plugins-ldap
|
||||
Requires: nagios-plugins-mysql
|
||||
Requires: nagios-plugins-pgsql
|
||||
Requires: nagios-plugins-tcp
|
||||
Requires: pcmk-cluster-manager
|
||||
|
||||
%description nagios-plugins-metadata
|
||||
The metadata files required for Pacemaker to execute the nagios plugin
|
||||
monitor resources.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{commit} -p1
|
||||
%setup -q -a 0 -n %{name}-%{commit}
|
||||
%setup -q -a 1 -n %{name}-%{commit}
|
||||
%autopatch -p1
|
||||
|
||||
# Force the local time
|
||||
#
|
||||
@ -240,7 +303,10 @@ docdir=%{pcmk_docdir} %{configure} \
|
||||
%{?with_coverage: --with-coverage} \
|
||||
--with-initdir=%{_initrddir} \
|
||||
--localstatedir=%{_var} \
|
||||
--with-version=%{version}-%{release}
|
||||
--with-version=%{version}-%{release} \
|
||||
--with-nagios \
|
||||
--with-nagios-metadata-dir=%{_datadir}/pacemaker/nagios/plugins-metadata/ \
|
||||
--with-nagios-plugin-dir=%{_libdir}/nagios/plugins/
|
||||
|
||||
make %{_smp_mflags} V=1 docdir=%{pcmk_docdir} all
|
||||
|
||||
@ -256,6 +322,11 @@ mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_var}/lib/pacemaker/cores
|
||||
install -m 644 mcp/pacemaker.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/pacemaker
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata
|
||||
for file in $(find %{nagios_name}-%{nagios_hash}/metadata -type f); do
|
||||
install -m 644 $file %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata
|
||||
done
|
||||
|
||||
%if %{with upstart_job}
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/init
|
||||
install -m 644 mcp/pacemaker.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/pacemaker.conf
|
||||
@ -356,6 +427,7 @@ exit 0
|
||||
|
||||
%exclude %{_datadir}/pacemaker/report.common
|
||||
%exclude %{_datadir}/pacemaker/report.collector
|
||||
%exclude %{_datadir}/pacemaker/nagios/plugins-metadata/*
|
||||
%{_datadir}/pacemaker
|
||||
%{_datadir}/snmp/mibs/PCMK-MIB.txt
|
||||
|
||||
@ -502,8 +574,22 @@ exit 0
|
||||
%license COPYING.LIB
|
||||
%doc AUTHORS
|
||||
|
||||
%files nagios-plugins-metadata
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/pacemaker/nagios/plugins-metadata
|
||||
%attr(0644,root,root) %{_datadir}/pacemaker/nagios/plugins-metadata/*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 20 2015 Andrew Beekhof <abeekhof@redhat.com> - 1.1.13-1
|
||||
* Wed Oct 14 2015 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 1.1.13-3
|
||||
- Update to Pacemaker-1.1.13 post-release + patches (sync)
|
||||
- Add nagios-plugins-metadata subpackage enabling support of selected
|
||||
Nagios plugins as resources recognized by Pacemaker
|
||||
- Several specfile improvements: drop irrelevant stuff, rehash the
|
||||
included/excluded files + dependencies, add check scriptlet,
|
||||
reflect current packaging practice, do minor cleanups
|
||||
(mostly adopted from another spec)
|
||||
|
||||
* Thu Aug 20 2015 Andrew Beekhof <abeekhof@redhat.com> - 1.1.13-2
|
||||
- Update for new upstream tarball: Pacemaker-1.1.13
|
||||
- See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/master/ChangeLog for full details
|
||||
|
||||
|
3
sources
3
sources
@ -1 +1,2 @@
|
||||
43529bc70e86c4a747c135eb9cf8ce8f pacemaker-6052cd16c2f455809f8088af76ce86483bf98353.tar.gz
|
||||
64bfe54641ba416b459955932d7bcab5 pacemaker-44eb2ddf8d4f8fc05256aae2abc9fbf3ae4d1fbc.tar.gz
|
||||
b914b3c0f16d2ba21339fb54e166500e nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz
|
||||
|
@ -1,27 +0,0 @@
|
||||
diff -r 39bbb85636f1 fencing/Makefile.am
|
||||
--- a/fencing/Makefile.am Tue Apr 26 09:43:57 2011 +0200
|
||||
+++ b/fencing/Makefile.am Wed Apr 27 12:00:39 2011 +0200
|
||||
@@ -26,14 +26,19 @@ halib_PROGRAMS = stonithd stonith-test
|
||||
sbin_PROGRAMS = stonith_admin
|
||||
sbin_SCRIPTS = fence_legacy
|
||||
|
||||
-if BUILD_HELP
|
||||
-man8_MANS = $(sbin_PROGRAMS:%=%.8) fence_legacy.8 stonithd.8
|
||||
+man8_MANS =
|
||||
+
|
||||
+if BUILD_XML_HELP
|
||||
+man8_MANS += stonithd.8
|
||||
stonithd.xml: stonithd
|
||||
- $(top_builddir)/fencing/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/crmd/$@
|
||||
+ $(top_builddir)/fencing/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/fencing/$@
|
||||
|
||||
stonithd.8: stonithd.xml
|
||||
- $(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/crmd/$<
|
||||
+ $(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/fencing/$<
|
||||
+endif
|
||||
|
||||
+if BUILD_HELP
|
||||
+man8_MANS += $(sbin_PROGRAMS:%=%.8) fence_legacy.8
|
||||
%.8: %
|
||||
echo Creating $@
|
||||
chmod a+x $<
|
Loading…
Reference in New Issue
Block a user