pacemaker/cman-fencing-override.patch

103 lines
3.3 KiB
Diff
Raw Normal View History

2011-04-27 07:30:30 +00:00
changeset: 10609:8e50dc3e0d06
user: Andrew Beekhof <andrew@beekhof.net>
date: Fri Mar 18 17:12:18 2011 +0100
files: crmd/te_utils.c
description:
High: cman: Correctly override existing fenced operations
diff -r b4f456380f60 -r 8e50dc3e0d06 crmd/te_utils.c
--- a/crmd/te_utils.c Thu Mar 17 09:41:25 2011 +0100
+++ b/crmd/te_utils.c Fri Mar 18 17:12:18 2011 +0100
@@ -146,17 +146,32 @@ tengine_stonith_notify(stonith_t *st, co
}
#ifdef SUPPORT_CMAN
- if(rc == stonith_ok && is_cman_cluster()) {
- int rc = 0;
+ if(rc == stonith_ok && is_cman_cluster()) {
+ int local_rc = 0;
+ FILE *confirm = NULL;
char *target_copy = crm_strdup(target);
- crm_info("Notifing CMAN that '%s' is now fenced", target);
- rc = fenced_external(target_copy);
- if(rc != 0) {
- crm_err("Could not notify fenced: rc=%d", rc);
+ /* In case fenced hasn't noticed yet */
+ local_rc = fenced_external(target_copy);
+ if(local_rc != 0) {
+ crm_err("Could not notify CMAN that '%s' is now fenced: %d", target, local_rc);
+ } else {
+ crm_notice("Notified CMAN that '%s' is now fenced", target);
+ }
+
+ /* In case fenced is already trying to shoot it */
+ confirm = fopen("/var/run/cluster/fenced_override", "w");
+ if(confirm) {
+ local_rc = fprintf(confirm, "%s\n", target_copy);
+ if(local_rc < strlen(target_copy)) {
+ crm_err("Confirmation of CMAN fencing event for '%s' failed: %d", target, local_rc);
+ } else {
+ crm_notice("Confirmed CMAN fencing event for '%s'", target);
}
- crm_free(target_copy);
- }
+ fflush(confirm);
+ fclose(confirm);
+ }
+ }
#endif
if(rc == stonith_ok && safe_str_eq(target, origin)) {
changeset: 10610:c6a01b02950b
tag: master
tag: tip
user: Andrew Beekhof <andrew@beekhof.net>
date: Sat Mar 19 10:50:21 2011 +0100
files: mcp/corosync.c mcp/pacemaker.c mcp/pacemaker.h
description:
High: cman: We need to run the crmd as root for CMAN so that we can ACK fencing operations
diff -r 8e50dc3e0d06 -r c6a01b02950b mcp/corosync.c
--- a/mcp/corosync.c Fri Mar 18 17:12:18 2011 +0100
+++ b/mcp/corosync.c Sat Mar 19 10:50:21 2011 +0100
@@ -641,6 +641,7 @@ gboolean read_config(void)
if(safe_str_eq("quorum_cman", value)) {
#ifdef SUPPORT_CMAN
setenv("HA_cluster_type", "cman", 1);
+ enable_crmd_as_root(TRUE);
use_cman = TRUE;
#else
crm_err("Corosync configured for CMAN but this build of Pacemaker doesn't support it");
diff -r 8e50dc3e0d06 -r c6a01b02950b mcp/pacemaker.c
--- a/mcp/pacemaker.c Fri Mar 18 17:12:18 2011 +0100
+++ b/mcp/pacemaker.c Sat Mar 19 10:50:21 2011 +0100
@@ -79,6 +79,15 @@ static pcmk_child_t pcmk_children[] = {
static gboolean start_child(pcmk_child_t *child);
+void enable_crmd_as_root(gboolean enable)
+{
+ if(enable) {
+ pcmk_children[pcmk_child_crmd].uid = NULL;
+ } else {
+ pcmk_children[pcmk_child_crmd].uid = CRM_DAEMON_USER;
+ }
+}
+
void enable_mgmtd(gboolean enable)
{
if(enable) {
diff -r 8e50dc3e0d06 -r c6a01b02950b mcp/pacemaker.h
--- a/mcp/pacemaker.h Fri Mar 18 17:12:18 2011 +0100
+++ b/mcp/pacemaker.h Sat Mar 19 10:50:21 2011 +0100
@@ -57,4 +57,5 @@ extern gboolean update_node_processes(ui
extern char *get_local_node_name(void);
extern void enable_mgmtd(gboolean enable);
+extern void enable_crmd_as_root(gboolean enable);