File pacemaker-crmd-set_join_state.patch of Package pacemaker
commit 4f9683a9edbc159fc00e36d5158549397074c60a
Author: Zhuravleva Aleksandra <zhuravleva357@gmail.com>
Date: Fri Mar 31 18:47:42 2017 +0300
add set_join_state()
diff --git a/crmd/join_client.c b/crmd/join_client.c
index de5b6f32e..67935c792 100644
--- a/crmd/join_client.c
+++ b/crmd/join_client.c
@@ -177,6 +177,32 @@ join_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *
free_xml(generation);
}
+static void
+set_join_state(const char * start_state)
+{
+ if (safe_str_eq(start_state, "standby")) {
+ char *attr_id = crm_strdup_printf("nodes-%.256s-standby", fsa_our_uuid);
+ crm_notice("Forcing node %s to join in %s state per configured environment",
+ fsa_our_uname, start_state);
+ update_attr_delegate(fsa_cib_conn, cib_sync_call, XML_CIB_TAG_NODES, fsa_our_uuid,
+ NULL, NULL, attr_id, "standby", "on", TRUE, NULL, NULL);
+
+ } else if (safe_str_eq(start_state, "online")) {
+ char *attr_id = crm_strdup_printf("nodes-%.256s-standby", fsa_our_uuid);
+ crm_notice("Forcing node %s to join in %s state per configured environment",
+ fsa_our_uname, start_state);
+ update_attr_delegate(fsa_cib_conn, cib_sync_call, XML_CIB_TAG_NODES, fsa_our_uuid,
+ NULL, NULL, attr_id, "standby", "off", TRUE, NULL, NULL);
+
+ } else if (safe_str_eq(start_state, "default")) {
+ crm_debug("Not forcing a starting state on node %s", fsa_our_uname);
+
+ } else {
+ crm_warn("Unrecognized start state '%s', using 'default' (%s)",
+ start_state, fsa_our_uname);
+ }
+}
+
/* A_CL_JOIN_RESULT */
/* aka. this is notification that we have (or have not) been accepted */
void
@@ -256,27 +282,7 @@ do_cl_join_finalize_respond(long long action,
update_attrd(fsa_our_uname, XML_CIB_ATTR_SHUTDOWN, "0", NULL, FALSE);
if (start_state) {
- if (safe_str_eq(start_state, "standby")) {
- char *attr_id = crm_strdup_printf("nodes-%.256s-standby", fsa_our_uuid);
- crm_notice("Forcing node %s to join in %s state per configured environment",
- fsa_our_uname, start_state);
- update_attr_delegate(fsa_cib_conn, cib_sync_call, XML_CIB_TAG_NODES, fsa_our_uuid,
- NULL, NULL, attr_id, "standby", "on", TRUE, NULL, NULL);
-
- } else if (safe_str_eq(start_state, "online")) {
- char *attr_id = crm_strdup_printf("nodes-%.256s-standby", fsa_our_uuid);
- crm_notice("Forcing node %s to join in %s state per configured environment",
- fsa_our_uname, start_state);
- update_attr_delegate(fsa_cib_conn, cib_sync_call, XML_CIB_TAG_NODES, fsa_our_uuid,
- NULL, NULL, attr_id, "standby", "off", TRUE, NULL, NULL);
-
- } else if (safe_str_eq(start_state, "default")) {
- crm_debug("Not forcing a starting state on node %s", fsa_our_uname);
-
- } else {
- crm_warn("Unrecognized start state '%s', using 'default' (%s)",
- start_state, fsa_our_uname);
- }
+ set_join_state(start_state);
}
}
diff --git a/lib/cib/cib_attrs.c b/lib/cib/cib_attrs.c
index 16705c544..a2b118f00 100644
--- a/lib/cib/cib_attrs.c
+++ b/lib/cib/cib_attrs.c
@@ -592,7 +592,6 @@ set_standby(cib_t * the_cib, const char *uuid, const char *scope, const char *st
} else {
scope = XML_CIB_TAG_NODES;
attr_id = crm_strdup_printf("standby-%.256s", uuid);
- // attr_id = crm_strdup_printf("nodes-%.256s-standby", uuid);
}
rc = update_attr_delegate(the_cib, cib_sync_call, scope, uuid, NULL, NULL,