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: crm by andrew from
([email protected])
2. Linux-HA CVS: crm by andrew from
([email protected])
3. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 7 Jul 2006 02:22:44 -0600 (MDT)
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
Log Message:
Free the existing CIB at shutdown
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -3 -r1.132 -r1.133
--- callbacks.c 6 Jul 2006 16:52:15 -0000 1.132
+++ callbacks.c 7 Jul 2006 08:22:43 -0000 1.133
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.132 2006/07/06 16:52:15 andrew Exp $ */
+/* $Id: callbacks.c,v 1.133 2006/07/07 08:22:43 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -1930,6 +1930,7 @@
} else {
crm_err("%s: No heartbeat connection", caller);
+ uninitializeCib();
exit(LSB_EXIT_OK);
}
}
------------------------------
Message: 2
Date: Fri, 7 Jul 2006 02:23:32 -0600 (MDT)
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:
io.c
Log Message:
Fix potential memory leak of op disgest result
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/io.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- io.c 6 Jul 2006 13:30:24 -0000 1.75
+++ io.c 7 Jul 2006 08:23:32 -0000 1.76
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.75 2006/07/06 13:30:24 andrew Exp $ */
+/* $Id: io.c,v 1.76 2006/07/07 08:23:32 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -101,10 +101,6 @@
gboolean passed = FALSE;
FILE *expected_strm = NULL;
int start = 0, length = 0, read_len = 0;
-
- if(local_cib != NULL) {
- digest = calculate_xml_digest(local_cib, FALSE);
- }
s_res = stat(CIB_FILENAME ".sig", &buf);
@@ -113,6 +109,10 @@
return TRUE;
}
+ if(local_cib != NULL) {
+ digest = calculate_xml_digest(local_cib, FALSE);
+ }
+
expected_strm = fopen(CIB_FILENAME ".sig", "r");
start = ftell(expected_strm);
fseek(expected_strm, 0L, SEEK_END);
@@ -152,9 +152,9 @@
CRM_ASSERT(digest_strm != NULL);
if(digest == NULL) {
- digest = calculate_xml_digest(local_cib, FALSE);
+ local_digest = calculate_xml_digest(local_cib, FALSE);
CRM_ASSERT(digest != NULL);
- local_digest = digest;
+ digest = local_digest;
}
rc = fprintf(digest_strm, "%s", digest);
------------------------------
Message: 3
Date: Fri, 7 Jul 2006 02:29:35 -0600 (MDT)
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 cibio.h io.c main.c
Log Message:
Implement an option (-f) that instructs the CIB to:
- read the (complete) CIB from disk before an operation
- write the (complete) CIB to disk after each operation
- deallocate the in-memory copy of the CIB after each operation
Aids debugging of memory leaks and should never be used in production
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -3 -r1.133 -r1.134
--- callbacks.c 7 Jul 2006 08:22:43 -0000 1.133
+++ callbacks.c 7 Jul 2006 08:29:34 -0000 1.134
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.133 2006/07/07 08:22:43 andrew Exp $ */
+/* $Id: callbacks.c,v 1.134 2006/07/07 08:29:34 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -1232,7 +1232,7 @@
crm_data_t *output = NULL;
crm_data_t *input = NULL;
- crm_data_t *current_cib = the_cib;
+ crm_data_t *current_cib = NULL;
crm_data_t *result_cib = NULL;
int call_type = 0;
@@ -1247,6 +1247,11 @@
*reply = NULL;
*cib_diff = NULL;
+ if(per_action_cib) {
+ CRM_CHECK(the_cib == NULL, free_xml(the_cib));
+ the_cib = readCibXmlFile(CIB_FILENAME, FALSE);
+ }
+ current_cib = the_cib;
/* Start processing the request... */
op = cl_get_string(request, F_CIB_OPERATION);
@@ -1262,6 +1267,7 @@
if(cib_status != cib_ok) {
*reply = cib_construct_reply(request, the_cib, cib_status);
+ uninitializeCib();
return cib_status;
}
@@ -1364,6 +1370,7 @@
if(call_type >= 0) {
cib_server_ops[call_type].cleanup(op, &input, &output);
}
+ uninitializeCib();
return rc;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/cibio.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- cibio.h 4 Jul 2006 14:07:42 -0000 1.17
+++ cibio.h 7 Jul 2006 08:29:34 -0000 1.18
@@ -1,4 +1,4 @@
-/* $Id: cibio.h,v 1.17 2006/07/04 14:07:42 andrew Exp $ */
+/* $Id: cibio.h,v 1.18 2006/07/07 08:29:34 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -34,6 +34,7 @@
#include <crm/common/xml.h>
extern gboolean initialized;
+extern gboolean per_action_cib;
extern crm_data_t *the_cib;
extern crm_data_t *node_search;
extern crm_data_t *resource_search;
@@ -48,7 +49,7 @@
extern crm_data_t *createEmptyCib(void);
extern gboolean verifyCibXml(crm_data_t *cib);
extern crm_data_t *readCibXml(char *buffer);
-extern crm_data_t *readCibXmlFile(const char *filename);
+extern crm_data_t *readCibXmlFile(const char *filename, gboolean
discard_status);
extern int activateCibBuffer(char *buffer, const char *filename);
extern int activateCibXml(crm_data_t *doc, const char *filename);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/io.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -3 -r1.76 -r1.77
--- io.c 7 Jul 2006 08:23:32 -0000 1.76
+++ io.c 7 Jul 2006 08:29:34 -0000 1.77
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.76 2006/07/07 08:23:32 andrew Exp $ */
+/* $Id: io.c,v 1.77 2006/07/07 08:29:34 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -204,7 +204,7 @@
* It is the callers responsibility to free the output of this function
*/
crm_data_t*
-readCibXmlFile(const char *filename)
+readCibXmlFile(const char *filename, gboolean discard_status)
{
int s_res = -1;
struct stat buf;
@@ -264,15 +264,18 @@
return NULL;
}
+ status = find_xml_node(root, XML_CIB_TAG_STATUS, FALSE);
+ if(root != NULL && discard_status && status != NULL) {
+ /* strip out the status section if there is one */
+ free_xml_from_parent(root, status);
+ status = NULL;
+ }
+ if(status == NULL) {
+ create_xml_node(root, XML_CIB_TAG_STATUS);
+ }
+
/* Do this before DTD validation happens */
if(root != NULL) {
- /* strip out the status section if there is one */
- status = find_xml_node(root, XML_CIB_TAG_STATUS, FALSE);
- if(status != NULL) {
- free_xml_from_parent(root, status);
- }
- create_xml_node(root, XML_CIB_TAG_STATUS);
-
/* fill in some defaults */
name = XML_ATTR_GENERATION_ADMIN;
value = crm_element_value(root, name);
@@ -506,7 +509,7 @@
activateCibXml(crm_data_t *new_cib, const char *ignored)
{
int error_code = cib_ok;
- crm_data_t *saved_cib = get_the_CIB();
+ crm_data_t *saved_cib = the_cib;
const char *ignore_dtd = NULL;
long new_bytes, new_allocs, new_frees;
@@ -551,6 +554,12 @@
" version to revert to");
}
+ } else if(per_action_cib && cib_writes_enabled && cib_status == cib_ok)
{
+ write_cib_contents(the_cib);
+ uninitializeCib();
+ free_xml(saved_cib);
+ return error_code;
+
} else if(cib_writes_enabled && cib_status == cib_ok) {
crm_debug_2("Triggering CIB write");
G_main_set_trigger(cib_writer);
@@ -629,13 +638,16 @@
*
* So delete the status section before we write it out
*/
- cib_status_root = find_xml_node(the_cib, XML_CIB_TAG_STATUS, TRUE);
- CRM_DEV_ASSERT(cib_status_root != NULL);
-
- if(cib_status_root != NULL) {
- free_xml_from_parent(the_cib, cib_status_root);
+ if(p == NULL) {
+ cib_status_root = find_xml_node(
+ the_cib, XML_CIB_TAG_STATUS, TRUE);
+ CRM_DEV_ASSERT(cib_status_root != NULL);
+
+ if(cib_status_root != NULL) {
+ free_xml_from_parent(the_cib, cib_status_root);
+ }
}
-
+
rc = write_xml_file(the_cib, CIB_FILENAME, FALSE);
if(rc <= 0) {
crm_err("Changes couldn't be written to disk");
@@ -659,7 +671,11 @@
exit(LSB_EXIT_GENERIC);
}
#endif
- exit(LSB_EXIT_OK);
+ if(p == NULL) {
+ exit(LSB_EXIT_OK);
+ }
+
+ crm_free(digest);
return HA_OK;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- main.c 6 Jul 2006 16:52:16 -0000 1.49
+++ main.c 7 Jul 2006 08:29:34 -0000 1.50
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.49 2006/07/06 16:52:16 andrew Exp $ */
+/* $Id: main.c,v 1.50 2006/07/07 08:29:34 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -55,6 +55,7 @@
gboolean cib_shutdown_flag = FALSE;
gboolean stand_alone = FALSE;
+gboolean per_action_cib = FALSE;
enum cib_errors cib_status = cib_ok;
extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int );
@@ -77,7 +78,7 @@
ll_cluster_t *hb_conn = NULL;
GTRIGSource *cib_writer = NULL;
-#define OPTARGS "hVs"
+#define OPTARGS "hVsf"
static void
cib_diskwrite_complete(gpointer userdata, int status, int signo, int exitcode)
@@ -128,6 +129,9 @@
case 'h': /* Help message */
usage(crm_system_name, LSB_EXIT_OK);
break;
+ case 'f':
+ per_action_cib = TRUE;
+ break;
default:
++argerr;
break;
@@ -495,7 +499,8 @@
gboolean
startCib(const char *filename)
{
- crm_data_t *cib = readCibXmlFile(filename);
+ gboolean active = FALSE;
+ crm_data_t *cib = readCibXmlFile(filename, TRUE);
if(cib == NULL) {
crm_warn("Cluster configuration not found: %s."
@@ -507,10 +512,10 @@
crm_xml_add(cib, XML_ATTR_NUMUPDATES, "0");
}
- if(activateCibXml(cib, filename) != 0) {
- return FALSE;
+ if(activateCibXml(cib, filename) == 0) {
+ active = TRUE;
+ crm_info("CIB Initialization completed successfully");
}
-
- crm_info("CIB Initialization completed successfully");
- return TRUE;
+
+ return active;
}
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 32, Issue 29
********************************************