Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: cts by andrew from
([email protected])
2. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 8 Feb 2006 14:58:58 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cts by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : cts
Dir : linux-ha/cts
Modified Files:
CM_LinuxHAv2.py.in
Log Message:
With the recent changes to SimulStop processing, there should never be
resources active at shutdown.
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CM_LinuxHAv2.py.in,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- CM_LinuxHAv2.py.in 2 Feb 2006 13:40:28 -0000 1.131
+++ CM_LinuxHAv2.py.in 8 Feb 2006 21:58:57 -0000 1.132
@@ -91,6 +91,8 @@
# Bad news Regexes. Should never occur.
"BadRegexes" : (
+ r"ERROR:",
+ r"CRIT:",
r"Shutting down\.",
r"Forcing shutdown\.",
r"Timer I_TERMINATE just popped",
@@ -107,8 +109,7 @@
r"Confirm not received from",
r"Welcome reply not received from",
r"Attempting to schedule .* after a stop",
- r"ERROR:",
- r"CRIT:",
+ r"Resource .* was active at shutdown",
),
})
del self["Standby"]
------------------------------
Message: 2
Date: Wed, 8 Feb 2006 15:12:06 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : crm
Dir : linux-ha/crm/cib
Modified Files:
callbacks.c io.c main.c
Log Message:
Fix for a crash bug found by Peter Kruse.
Steps to reproduce on his system:
node2# crm_resource -M -r rg1 -H ha-test-1
node1# crm_resource -U -r rg1
node1# crm_mon -1
The -U command deletes the constraints, at some point between this and the
next query (quite probably during activation) the CIB corrupted itself and
dumped core.
In the process of fixing this, I:
- cleaned up the CIB activation code
- made sure wraparounds of the per-connection cib operation id is handled
correctly
- simplified the IPC loop handling "syncronous" CIB calls in cib_native.c
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -3 -r1.104 -r1.105
--- callbacks.c 3 Feb 2006 08:33:04 -0000 1.104
+++ callbacks.c 8 Feb 2006 22:12:06 -0000 1.105
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.104 2006/02/03 08:33:04 andrew Exp $ */
+/* $Id: callbacks.c,v 1.105 2006/02/08 22:12:06 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -1081,7 +1081,7 @@
if(rc != cib_ok) {
free_xml(result_cib);
- } else if(activateCibXml(result_cib, CIB_FILENAME) < 0){
+ } else if(activateCibXml(result_cib, CIB_FILENAME) != 0){
crm_warn("Activation failed");
rc = cib_ACTIVATION;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/io.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- io.c 5 Feb 2006 11:52:01 -0000 1.44
+++ io.c 8 Feb 2006 22:12:06 -0000 1.45
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.44 2006/02/05 11:52:01 andrew Exp $ */
+/* $Id: io.c,v 1.45 2006/02/08 22:12:06 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -261,47 +261,48 @@
gboolean
initializeCib(crm_data_t *new_cib)
{
-#if 0
- if(new_cib != NULL) {
- crm_set_element_parent(new_cib, NULL);
- }
-#endif
- if (verifyCibXml(new_cib)) {
-
- initialized = FALSE;
- the_cib = new_cib;
-
- /* update search paths */
- /* not used yet...
- node_search =
- get_object_root(XML_CIB_TAG_NODES, new_cib);
- resource_search =
- get_object_root(XML_CIB_TAG_RESOURCES, new_cib);
- constraint_search =
- get_object_root(XML_CIB_TAG_CONSTRAINTS, new_cib);
- status_search =
- get_object_root(XML_CIB_TAG_STATUS, new_cib);
- */
- initialized = TRUE;
+ gboolean is_valid = TRUE;
+ crm_data_t *tmp_node = NULL;
+
+ if(new_cib == NULL) {
+ return FALSE;
}
+
+ xml_validate(new_cib);
- if(initialized == FALSE) {
- crm_warn("CIB Verification failed");
- the_cib = NULL;
+ tmp_node = get_object_root(XML_CIB_TAG_NODES, new_cib);
+ if (tmp_node == NULL) { is_valid = FALSE; }
- } else {
- set_connected_peers(the_cib);
- set_transition(the_cib);
- if(cib_have_quorum) {
- crm_xml_add(
- the_cib,XML_ATTR_HAVE_QUORUM,XML_BOOLEAN_TRUE);
- } else {
- crm_xml_add(
- the_cib,XML_ATTR_HAVE_QUORUM,XML_BOOLEAN_FALSE);
- }
+ tmp_node = get_object_root(XML_CIB_TAG_RESOURCES, new_cib);
+ if (tmp_node == NULL) { is_valid = FALSE; }
+
+ tmp_node = get_object_root(XML_CIB_TAG_CONSTRAINTS, new_cib);
+ if (tmp_node == NULL) { is_valid = FALSE; }
+
+ tmp_node = get_object_root(XML_CIB_TAG_CRMCONFIG, new_cib);
+ if (tmp_node == NULL) { is_valid = FALSE; }
+
+ tmp_node = get_object_root(XML_CIB_TAG_STATUS, new_cib);
+ if (is_valid && tmp_node == NULL) {
+ create_xml_node(new_cib, XML_CIB_TAG_STATUS);
}
- return initialized;
+ if(is_valid == FALSE) {
+ crm_warn("CIB Verification failed");
+ return FALSE;
+ }
+
+ set_transition(new_cib);
+ set_connected_peers(new_cib);
+ if(cib_have_quorum) {
+ crm_xml_add(new_cib, XML_ATTR_HAVE_QUORUM, XML_BOOLEAN_TRUE);
+ } else {
+ crm_xml_add(new_cib, XML_ATTR_HAVE_QUORUM, XML_BOOLEAN_FALSE);
+ }
+
+ the_cib = new_cib;
+ initialized = TRUE;
+ return TRUE;
}
int
@@ -355,60 +356,37 @@
}
-
-int
-activateCibBuffer(char *buffer, const char *filename)
-{
- int result = -1;
- crm_data_t *local_cib = NULL;
-
-
- local_cib = readCibXml(buffer);
- result = activateCibXml(local_cib, filename);
-
- return result;
-}
-
/*
* This method will free the old CIB pointer on success and the new one
* on failure.
*/
-#define ACTIVATION_DIFFS 0
int
activateCibXml(crm_data_t *new_cib, const char *filename)
{
int error_code = cib_ok;
- crm_data_t *diff = NULL;
crm_data_t *saved_cib = get_the_CIB();
const char *filename_bak = CIB_BACKUP; /* calculate */
crm_log_xml_debug_4(new_cib, "Attempting to activate CIB");
CRM_ASSERT(new_cib != saved_cib);
- crm_validate_data(new_cib);
if(saved_cib != NULL) {
crm_validate_data(saved_cib);
}
if (initializeCib(new_cib) == FALSE) {
- crm_warn("Ignoring invalid or NULL Cib");
- error_code = -5;
+ crm_warn("Ignoring invalid or NULL CIB");
+ error_code = -1;
} else if(cib_writes_enabled) {
- if(saved_cib != NULL) {
-
- CRM_DEV_ASSERT(0 >= moveFile(filename,
- filename_bak,
- FALSE, NULL));
-
- if (crm_assert_failed) {
- crm_warn("Could not make backup of the current"
- " Cib... aborting update.");
- error_code = -1;
- }
+ int local_rc = moveFile(filename, filename_bak, FALSE, NULL);
+ if(local_rc != 0) {
+ crm_err("Could not make backup of the current CIB..."
+ " disabling writes.");
+ cib_writes_enabled = FALSE;
}
- if(error_code == cib_ok) {
+ if(cib_writes_enabled) {
crm_data_t *cib_copy_status = NULL;
crm_data_t *cib_copy_no_status = NULL;
@@ -433,89 +411,63 @@
free_xml_from_parent(
cib_copy_no_status, cib_copy_status);
- create_xml_node(cib_copy_no_status, XML_CIB_TAG_STATUS);
- CRM_DEV_ASSERT(
- write_xml_file(
- cib_copy_no_status, CIB_FILENAME) >= 0);
+ local_rc = write_xml_file(
+ cib_copy_no_status, filename);
- free_xml(cib_copy_no_status);
-
- if (crm_assert_failed) {
- error_code = -4;
- }
- }
+ CRM_DEV_ASSERT(local_rc != -1 && local_rc != 0);
- if(error_code == -4 && saved_cib != NULL) {
- CRM_DEV_ASSERT(moveFile(filename_bak,
- filename, FALSE, NULL) >= 0);
- if (crm_assert_failed){
- crm_crit("Could not restore the backup of the "
- " current Cib... panic!");
+ if(crm_assert_failed) {
+ crm_err("Changes activated but couldn't"
+ " be written to disk");
error_code = -2;
- /* should probably exit here */
}
+
+ free_xml(cib_copy_no_status);
}
+ }
- CRM_DEV_ASSERT(saved_cib != NULL || error_code == cib_ok);
- if(crm_assert_failed) {
+ if(error_code != cib_ok && saved_cib != NULL) {
+ int local_rc = 0;
+ crm_crit("Reverting to last known CIB (%d)...", error_code);
+ CRM_DEV_ASSERT(initializeCib(saved_cib));
+ if (crm_assert_failed) {
/* oh we are so dead */
- crm_crit("Could not write out new CIB and no saved"
- " version to revert to");
- if(error_code == cib_ok) {
- error_code = -3;
- }
-
- } else if(error_code != cib_ok) {
- crm_crit("Update of Cib failed (%d)... reverting"
- " to last known valid version",
- error_code);
-
- CRM_DEV_ASSERT(initializeCib(saved_cib));
- if (crm_assert_failed) {
- /* oh we are so dead */
- crm_crit("Could not re-initialize with the old"
- " CIB. Can anyone say corruption?");
- error_code = -3;
+ crm_crit("Could not re-initialize with the old CIB.");
+ local_rc = -3;
+ }
+
+ if(local_rc == 0 && cib_writes_enabled) {
+ local_rc = moveFile(filename_bak, filename,FALSE,NULL);
+ CRM_DEV_ASSERT(local_rc >= 0);
+ if (crm_assert_failed){
+ /* At least if we stay up the config isnt lost
+ */
+ crm_crit("Could not restore the backup of the "
+ " current Cib... disabling writes");
+ cib_writes_enabled = FALSE;
}
}
+
+ } else if(error_code != cib_ok) {
+ crm_crit("Could not write out new CIB and no saved"
+ " version to revert to");
+ }
+
+ if(the_cib != saved_cib && the_cib != new_cib) {
+ CRM_DEV_ASSERT(error_code != cib_ok);
+ CRM_DEV_ASSERT(the_cib == NULL);
}
-#if ACTIVATION_DIFFS
- /* Make sure memory is cleaned up appropriately */
- if(saved_cib != NULL && new_cib != NULL) {
- diff = diff_cib_object(saved_cib, new_cib, -1);
- }
- if (error_code != cib_ok) {
- crm_err("Changes could not be activated: %s",
- cib_error2string(error_code));
- log_cib_diff(LOG_WARNING, diff, __FUNCTION__);
+ if(the_cib != new_cib) {
free_xml(new_cib);
-
- } else if(saved_cib != NULL) {
- crm_debug_2("Changes activated");
- log_cib_diff(LOG_DEBUG, diff, __FUNCTION__);
- crm_validate_data(saved_cib);
- free_xml(saved_cib);
+ CRM_DEV_ASSERT(error_code != cib_ok);
}
- free_xml(diff);
-#else
- if (error_code == -4) {
- crm_err("Changes activated but couldnt be written to disk");
- free_xml(saved_cib);
- } else if (error_code != cib_ok) {
- crm_err("Changes could not be activated: %s",
- cib_error2string(error_code));
- free_xml(new_cib);
-
- } else if(saved_cib != NULL) {
- crm_debug_2("Changes activated");
- crm_validate_data(saved_cib);
+ if(the_cib != saved_cib) {
free_xml(saved_cib);
- }
-#endif
- diff = NULL;
+ }
+
return error_code;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- main.c 2 Feb 2006 11:10:32 -0000 1.35
+++ main.c 8 Feb 2006 22:12:06 -0000 1.36
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.35 2006/02/02 11:10:32 andrew Exp $ */
+/* $Id: main.c,v 1.36 2006/02/08 22:12:06 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -173,14 +173,14 @@
local_log_level = LOG_INFO;
crm_log_maybe(local_log_level,
"Processed %lu operations"
- " (%.2fms average, %lu%% utilization) in the last
%s",
+ " (%.2fus average, %lu%% utilization) in the last
%s",
calls_diff, stat_1,
(100*cib_calls_ms)/cib_stat_interval_ms,
cib_stat_interval);
}
crm_log_maybe(local_log_level+1,
- "\tDetail: %lu operations (%ums average)"
+ "\tDetail: %lu operations (%ums total)"
" (%lu local, %lu updates, %lu failures,"
" %lu timeouts, %lu bad connects)",
cib_num_ops, cib_calls_ms, cib_num_local, cib_num_updates,
@@ -452,14 +452,21 @@
startCib(const char *filename)
{
crm_data_t *cib = readCibXmlFile(filename);
- if (initializeCib(cib)) {
- crm_info("CIB Initialization completed successfully");
- } else {
- /* free_xml(cib); */
+
+ if(cib == NULL) {
crm_warn("CIB Initialization failed, "
"starting with an empty default.");
- cib = readCibXml(NULL);
- activateCibXml(cib, filename);
+
+ cib = createEmptyCib();
+ crm_xml_add(cib, XML_ATTR_GENERATION_ADMIN, "0");
+ crm_xml_add(cib, XML_ATTR_GENERATION, "0");
+ crm_xml_add(cib, XML_ATTR_NUMUPDATES, "0");
+ }
+
+ if(activateCibXml(cib, filename) != 0) {
+ return FALSE;
}
+
+ crm_info("CIB Initialization completed successfully");
return TRUE;
}
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 27, Issue 36
********************************************