1 file changed, 29 insertions(+), 16 deletions(-)
crmd/pengine.c | 45 +++++++++++++++++++++++++++++----------------
# HG changeset patch
# User Andrew Beekhof <[EMAIL PROTECTED]>
# Date 1226349737 -3600
# Branch stable-1.0
# Node ID a911aa1094d3546db05cf2b4196c1d84a8c91666
# Parent 79ed4dde4fc33d651b58ab90df4ac50651bcd3a6
Medium: crmd: Fix the handling of unexpected PE exits to ensure the current CIB is stored
diff --git a/crmd/pengine.c b/crmd/pengine.c
--- a/crmd/pengine.c
+++ b/crmd/pengine.c
@@ -60,13 +60,21 @@ static void
static void
save_cib_contents(xmlNode *msg, int call_id, int rc, xmlNode *output, void *user_data)
{
- char *pid = user_data;
+ char *id = user_data;
register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, NULL, NULL, __FUNCTION__);
-
+ CRM_CHECK(id != NULL, return);
+
if(rc == cib_ok) {
+ int len = 15;
char *filename = NULL;
- filename = generate_series_filename(PE_WORKING_DIR, "pe-core", crm_atoi(pid, 0), TRUE);
+
+ len += strlen(id);
+ len += strlen(PE_WORKING_DIR);
+ crm_malloc0(filename, len);
+ CRM_CHECK(filename != NULL, return);
+
+ sprintf(filename, PE_WORKING_DIR "/pe-core-%s.bz2", id);
if(write_xml_file(output, filename, TRUE) < 0) {
crm_err("Could not save CIB contents after PE crash to %s", filename);
} else {
@@ -76,7 +84,7 @@ save_cib_contents(xmlNode *msg, int call
crm_free(filename);
}
- crm_free(pid);
+ crm_free(id);
}
static void
@@ -84,12 +92,16 @@ pe_connection_destroy(gpointer user_data
{
clear_bit_inplace(fsa_input_register, pe_subsystem->flag_connected);
if(is_set(fsa_input_register, pe_subsystem->flag_required)) {
- crm_crit("Connection to the Policy Engine failed");
+ int rc = cib_ok;
+ cl_uuid_t new_uuid;
+ char uuid_str[UU_UNPARSE_SIZEOF];
- if(pe_subsystem->pid > 0) {
- int rc = cib_ok;
- char *pid = crm_itoa(pe_subsystem->pid);
-
+ cl_uuid_generate(&new_uuid);
+ cl_uuid_unparse(&new_uuid, uuid_str);
+
+ crm_crit("Connection to the Policy Engine failed (pid=%d, uuid=%s)",
+ pe_subsystem->pid, uuid_str);
+
/*
*The PE died...
*
@@ -100,13 +112,10 @@ pe_connection_destroy(gpointer user_data
* 5s is up, whichever comes first.
*
*/
- rc = fsa_cib_conn->cmds->query(fsa_cib_conn, NULL, NULL, cib_scope_local);
- fsa_cib_conn->cmds->register_callback(
- fsa_cib_conn, rc, 5, TRUE, pid, "save_cib_contents", save_cib_contents);
-
- } else {
- register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, NULL, NULL, __FUNCTION__);
- }
+ rc = fsa_cib_conn->cmds->query(fsa_cib_conn, NULL, NULL, cib_scope_local);
+ fsa_cib_conn->cmds->register_callback(
+ fsa_cib_conn, rc, 5, FALSE, crm_strdup(uuid_str),
+ "save_cib_contents", save_cib_contents);
} else {
crm_info("Connection to the Policy Engine released");
@@ -200,6 +209,10 @@ do_pe_control(long long action,
return;
}
+ if(is_openais_cluster()) {
+ pe_subsystem->pid = pe_subsystem->ipc->farside_pid;;
+ }
+
set_bit_inplace(fsa_input_register, pe_subsystem->flag_connected);
pe_source = G_main_add_IPC_Channel(
G_PRIORITY_HIGH, pe_subsystem->ipc, FALSE, pe_msg_dispatch, NULL,
_______________________________________________
Pacemaker mailing list
[email protected]
http://list.clusterlabs.org/mailman/listinfo/pacemaker