1.1.14-1: new release, spec refresh, crm_mon X curses fix

Resolves: rhbz#1297985
This commit is contained in:
Jan Pokorný 2016-01-18 18:49:03 +01:00
parent 7054e2ca66
commit ec5191b256
No known key found for this signature in database
GPG Key ID: 61BBB23A9E8F8DE2
42 changed files with 124 additions and 23322 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/ClusterLabs-pacemaker-*.tar.gz
/pacemaker-*.tar.gz
/[Pp]acemaker-*.tar.gz
/nagios-agents-metadata-*.tar.gz

View File

@ -1,82 +0,0 @@
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

View File

@ -1,328 +0,0 @@
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

View File

@ -1,21 +0,0 @@
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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
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;

View File

@ -1,31 +0,0 @@
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;
}

View File

@ -1,34 +0,0 @@
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

View File

@ -1,24 +0,0 @@
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) {

View File

@ -1,565 +0,0 @@
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;

View File

@ -1,47 +0,0 @@
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) {

View File

@ -1,58 +0,0 @@
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!!"

View File

@ -1,22 +0,0 @@
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;
}

View File

@ -1,109 +0,0 @@
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;
}

View File

@ -1,23 +0,0 @@
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);

View File

@ -1,299 +0,0 @@
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);
}

View File

@ -1,94 +0,0 @@
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 */
{

View File

@ -1,23 +0,0 @@
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;

View File

@ -1,58 +0,0 @@
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());

View File

@ -1,27 +0,0 @@
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);
}

View File

@ -1,24 +0,0 @@
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':

View File

@ -1,92 +0,0 @@
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);

View File

@ -1,23 +0,0 @@
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;
}

View File

@ -1,29 +0,0 @@
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);

View File

@ -1,35 +0,0 @@
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;

View File

@ -1,115 +0,0 @@
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();

View File

@ -1,127 +0,0 @@
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);

View File

@ -1,34 +0,0 @@
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;
}

View File

@ -1,38 +0,0 @@
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;
}

View File

@ -1,182 +0,0 @@
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;

View File

@ -1,46 +0,0 @@
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);
}

View File

@ -1,21 +0,0 @@
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."

View File

@ -1,87 +0,0 @@
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! */

View File

@ -1,27 +0,0 @@
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;
}

View File

@ -1,179 +0,0 @@
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);

View File

@ -1,75 +0,0 @@
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");
}

View File

@ -0,0 +1,23 @@
--- a/configure.ac 2016-01-18 17:40:43.096090475 +0100
+++ b/configure.ac 2016-01-18 17:54:09.426193896 +0100
@@ -941,12 +941,18 @@
dnl Check for printw() prototype compatibility
if test X"$CURSESLIBS" != X"" && cc_supports_flag -Wcast-qual && cc_supports_flag -Werror; then
- AC_MSG_CHECKING(whether printw() requires argument of "const char *")
ac_save_LIBS=$LIBS
- LIBS="$CURSESLIBS $LIBS"
+ LIBS="$CURSESLIBS"
ac_save_CFLAGS=$CFLAGS
CFLAGS="-Wcast-qual -Werror"
+ # avoid broken test because of hardened build environment in Fedora 23+
+ # - https://fedoraproject.org/wiki/Changes/Harden_All_Packages
+ # - https://bugzilla.redhat.com/1297985
+ if cc_supports_flag -fPIC; then
+ CFLAGS="$CFLAGS -fPIC"
+ fi
+ AC_MSG_CHECKING(whether printw() requires argument of "const char *")
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
%global uname hacluster
%global pcmk_docdir %{_docdir}/%{name}
%global specversion 4
%global commit 44eb2ddf8d4f8fc05256aae2abc9fbf3ae4d1fbc
%global specversion 1
%global commit Pacemaker-1.1.14
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global github_owner ClusterLabs
@ -21,7 +21,11 @@
%global rawhide %(test ! -e /etc/yum.repos.d/fedora-rawhide.repo; echo $?)
%global cs_version %(pkg-config corosync --modversion | awk -F . '{print $1}')
%global py_site %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
# It has to be eventually decided whether to use Python2 or Python3
%global py_site %{?python_sitearch}%{!?python_sitearch:%(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
# https://fedoraproject.org/wiki/EPEL:Packaging?rd=Packaging:EPEL#The_.25license_tag
%{!?_licensedir:%global license %doc}
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
@ -56,54 +60,16 @@
Name: pacemaker
Summary: Scalable High-Availability cluster resource manager
Version: 1.1.13
Version: 1.1.14
Release: %{pcmk_release}%{?dist}
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
# ---
Patch1: bz1297985-fix-configure-curses-test.patch
# keep following commented out for now
#Patch100: bz1179335-system-wide-crypto-policies.patch
@ -123,8 +89,11 @@ Provides: pcmk-cluster-manager
# Required for core functionality
BuildRequires: automake autoconf libtool pkgconfig python libtool-ltdl-devel
BuildRequires: glib2-devel libxml2-devel libxslt-devel libuuid-devel
BuildRequires: pkgconfig python-devel gcc-c++ bzip2-devel pam-devel
BuildRequires: pkgconfig(glib-2.0) libxml2-devel libxslt-devel libuuid-devel
BuildRequires: bzip2-devel pam-devel
# This is for python_sitearch macro
BuildRequires: python-devel
# Required for agent_config.h which specifies the correct scratch directory
BuildRequires: resource-agents
@ -135,14 +104,14 @@ Requires: libqb > 0.17.0
# Enables optional functionality
BuildRequires: ncurses-devel openssl-devel libselinux-devel docbook-style-xsl
BuildRequires: bison byacc flex help2man gnutls-devel dbus-devel
BuildRequires: bison byacc flex help2man gnutls-devel pkgconfig(dbus-1)
%if %{defined _unitdir}
BuildRequires: systemd-devel
%endif
Requires: corosync
BuildRequires: corosynclib-devel
BuildRequires: pkgconfig(corosync)
%if !%{rawhide}
# More often than not, inkscape is busted on rawhide, don't even bother
@ -170,11 +139,11 @@ Available rpmbuild rebuild options:
--with(out) : doc coverage profiling pre_release upstart_job
%package cli
License: GPLv2+ and LGPLv2+
Summary: Command line tools for controlling Pacemaker clusters
Group: System Environment/Daemons
Requires: %{name}-libs = %{version}-%{release}
Requires: perl-TimeDate
License: GPLv2+ and LGPLv2+
Summary: Command line tools for controlling Pacemaker clusters
Group: System Environment/Daemons
Requires: %{name}-libs = %{version}-%{release}
Requires: perl-TimeDate
%description cli
Pacemaker is an advanced, scalable High-Availability cluster resource
@ -185,9 +154,9 @@ to query and control the cluster from machines that may, or may not,
be part of the cluster.
%package -n %{name}-libs
License: GPLv2+ and LGPLv2+
Summary: Core Pacemaker libraries
Group: System Environment/Daemons
License: GPLv2+ and LGPLv2+
Summary: Core Pacemaker libraries
Group: System Environment/Daemons
%description -n %{name}-libs
Pacemaker is an advanced, scalable High-Availability cluster resource
@ -197,10 +166,10 @@ The %{name}-libs package contains shared libraries needed for cluster
nodes and those just running the CLI tools.
%package -n %{name}-cluster-libs
License: GPLv2+ and LGPLv2+
Summary: Cluster Libraries used by Pacemaker
Group: System Environment/Daemons
Requires: %{name}-libs = %{version}-%{release}
License: GPLv2+ and LGPLv2+
Summary: Cluster Libraries used by Pacemaker
Group: System Environment/Daemons
Requires: %{name}-libs = %{version}-%{release}
%description -n %{name}-cluster-libs
Pacemaker is an advanced, scalable High-Availability cluster resource
@ -210,13 +179,13 @@ The %{name}-cluster-libs package contains cluster-aware shared
libraries needed for nodes that will form part of the cluster nodes.
%package remote
License: GPLv2+ and LGPLv2+
Summary: Pacemaker remote daemon for non-cluster nodes
Group: System Environment/Daemons
Requires: %{name}-libs = %{version}-%{release}
Requires: %{name}-cli = %{version}-%{release}
Requires: resource-agents
Provides: pcmk-cluster-manager
License: GPLv2+ and LGPLv2+
Summary: Pacemaker remote daemon for non-cluster nodes
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
@ -324,6 +293,7 @@ make DESTDIR=%{buildroot} docdir=%{pcmk_docdir} V=1 install
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
install -m 644 tools/crm_mon.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/crm_mon
mkdir -p %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata
for file in $(find %{nagios_name}-%{nagios_hash}/metadata -type f); do
@ -334,6 +304,7 @@ done
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/init
install -m 644 mcp/pacemaker.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/pacemaker.conf
install -m 644 mcp/pacemaker.combined.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/pacemaker.combined.conf
install -m 644 tools/crm_mon.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/crm_mon.conf
%endif
# Scripts that should be executable
@ -345,7 +316,7 @@ find %{buildroot} -name '*.xsl' -type f -print0 | xargs -0 chmod a-x
find %{buildroot} -name '*.rng' -type f -print0 | xargs -0 chmod a-x
find %{buildroot} -name '*.dtd' -type f -print0 | xargs -0 chmod a-x
# Dont package static libs
# Don't package static libs
find %{buildroot} -name '*.a' -type f -print0 | xargs -0 rm -f
find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f
@ -374,6 +345,8 @@ done
%clean
rm -rf %{buildroot}
%if %{defined _unitdir}
%post
%systemd_post pacemaker.service
@ -383,12 +356,6 @@ rm -rf %{buildroot}
%postun
%systemd_postun_with_restart pacemaker.service
%post cli
%systemd_post crm_mon.service
%preun cli
%systemd_preun crm_mon.service
%post remote
%systemd_post pacemaker_remote.service
@ -398,6 +365,39 @@ rm -rf %{buildroot}
%postun remote
%systemd_postun_with_restart pacemaker_remote.service
%post cli
%systemd_post crm_mon.service
%preun cli
%systemd_preun crm_mon.service
%postun cli
%systemd_postun_with_restart crm_mon.service
%else
%post
/sbin/chkconfig --add pacemaker || :
%preun
/sbin/service pacemaker stop || :
if [ $1 -eq 0 ]; then
# Package removal, not upgrade
/sbin/chkconfig --del pacemaker || :
fi
%post remote
/sbin/chkconfig --add pacemaker_remote || :
%preun remote
/sbin/service pacemaker_remote stop &>/dev/null || :
if [ $1 -eq 0 ]; then
# Package removal, not upgrade
/sbin/chkconfig --del pacemaker_remote || :
fi
%endif
%pre -n %{name}-libs
getent group %{gname} >/dev/null || groupadd -r %{gname} -g 189
@ -480,6 +480,17 @@ exit 0
%files cli
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/sysconfig/crm_mon
%if %{defined _unitdir}
%{_unitdir}/crm_mon.service
%endif
%if %{with upstart_job}
%config(noreplace) %{_sysconfdir}/init/crm_mon.conf
%endif
%{_sbindir}/cibadmin
%{_sbindir}/crm_diff
%{_sbindir}/crm_error
@ -507,10 +518,6 @@ exit 0
%exclude %{_mandir}/man8/pacemaker_remoted.*
%exclude %{_mandir}/man8/stonith_admin.*
%if %{defined _unitdir}
%{_unitdir}/crm_mon.service
%endif
%license COPYING
%doc AUTHORS
%doc ChangeLog
@ -583,6 +590,21 @@ exit 0
%attr(0644,root,root) %{_datadir}/pacemaker/nagios/plugins-metadata/*
%changelog
* Mon Jan 18 2016 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 1.1.14-1
- Update for new upstream tarball: Pacemaker-1.1.14,
for full details, see included ChangeLog file or
https://github.com/ClusterLabs/pacemaker/releases/tag/Pacemaker-1.1.14
- Disable Fedora crypto policies conformance patch for now (rhbz#1179335)
- Better align specfile with the upstream version (also fix issue with
crm_mon sysconfig file not being installed)
- Futher specfile modifications:
- drop unused gcc-c++ and repeatedly mentioned pkgconfig packages
from BuildRequires
- refer to python_sitearch macro first, if defined
- tolerate license macro not being defined (e.g., for EPEL rebuilds)
- Prevent console mode not available in crm_mon due to curses library test
fragility of configure script in hardened build environment (rhbz#1297985)
* Tue Oct 20 2015 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 1.1.13-4
- Adapt to follow Fedora crypto policies (rhbz#1179335)

View File

@ -1,2 +1,2 @@
64bfe54641ba416b459955932d7bcab5 pacemaker-44eb2ddf8d4f8fc05256aae2abc9fbf3ae4d1fbc.tar.gz
8f9973085512b6782c019b6d9a78ca8e Pacemaker-1.1.14.tar.gz
b914b3c0f16d2ba21339fb54e166500e nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz