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])
----------------------------------------------------------------------
Message: 1
Date: Mon, 3 Apr 2006 04:01: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 main.c messages.c
Log Message:
Cut down on CIB logging...
- ignore the KEY_LOG_CONFIG_CHANGES option, and instead
- only log changes when we are in "master" mode which just means we're
running on the same node as the DC
- the master logs changes at LOG_DEBUG
- other nodes continue to log changes but at LOG_DEBUG_2 which can be accessed
by sending SIGUSR1 to the CIB process (or setting debug 2 in ha.cf)
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- callbacks.c 17 Mar 2006 01:05:58 -0000 1.116
+++ callbacks.c 3 Apr 2006 10:01:34 -0000 1.117
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.116 2006/03/17 01:05:58 andrew Exp $ */
+/* $Id: callbacks.c,v 1.117 2006/04/03 10:01:34 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -542,12 +542,9 @@
crm_debug("Invalid operation %s from %s/%s",
op, cib_client->name, cib_client->channel_name);
- } else if(cib_server_ops[call_type].modifies_cib) {
- crm_info("Processing %s operation from %s/%s",
- op, cib_client->name, cib_client->channel_name);
} else {
- crm_debug("Processing %s operation from %s/%s",
- op, cib_client->name, cib_client->channel_name);
+ crm_debug_2("Processing %s operation from %s/%s",
+ op, cib_client->name, cib_client->channel_name);
}
crm_log_message_adv(LOG_MSG, "Client[inbound]", op_request);
@@ -1385,7 +1382,7 @@
const char *op = cl_get_string(msg, F_CIB_OPERATION);
crm_log_message_adv(LOG_MSG, "Peer[inbound]", msg);
- crm_debug("Peer %s message (%s) from %s", op, seq, originator);
+ crm_debug_2("Peer %s message (%s) from %s", op, seq, originator);
if(originator == NULL || safe_str_eq(originator, cib_our_uname)) {
crm_debug_3("Discarding %s message from ourselves", op);
@@ -1407,12 +1404,7 @@
return;
}
- if(cib_server_ops[call_type].modifies_cib) {
- crm_info("Processing %s msg (%s) from %s", op, seq, originator);
-
- } else {
- crm_debug("Processing %s msg (%s) from %s",op, seq, originator);
- }
+ crm_debug_2("Processing %s msg (%s) from %s",op, seq, originator);
ha_msg_value_int(msg, F_CIB_CALLOPTS, &call_options);
crm_debug_4("Retrieved call options: %d", call_options);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- main.c 8 Mar 2006 22:24:29 -0000 1.40
+++ main.c 3 Apr 2006 10:01:35 -0000 1.41
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.40 2006/03/08 22:24:29 andrew Exp $ */
+/* $Id: main.c,v 1.41 2006/04/03 10:01:35 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -54,7 +54,6 @@
#include <crm/dmalloc_wrapper.h>
gboolean cib_shutdown_flag = FALSE;
-unsigned int cib_diff_loglevel = LOG_INFO;
extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int );
@@ -100,8 +99,6 @@
{
int flag;
int argerr = 0;
- char *param_val = NULL;
- const char *param_name = NULL;
crm_log_init(crm_system_name);
G_main_add_SignalHandler(
@@ -140,32 +137,6 @@
usage(crm_system_name,LSB_EXIT_GENERIC);
}
- /* apparently we're not allowed to free the result of getenv */
- param_name = ENV_PREFIX "" KEY_CONFIG_WRITES_ENABLED;
- param_val = getenv(param_name);
- crm_debug("%s = %s", param_name, param_val);
- if(param_val != NULL) {
- cl_str_to_boolean(param_val, &cib_writes_enabled);
- param_val = NULL;
- }
- crm_info("Disk writes to %s: %s", CIB_FILENAME,
- cib_writes_enabled?"enabled":"DISABLED");
-
- param_name = ENV_PREFIX "" KEY_LOG_CONFIG_CHANGES;
- param_val = getenv(param_name);
- crm_debug("%s = %s", param_name, param_val);
- cib_diff_loglevel = crm_log_level;
- if(param_val != NULL) {
- int do_log = 0;
- cl_str_to_boolean(param_val, &do_log);
- if(do_log == FALSE) {
- cib_diff_loglevel = crm_log_level + 1;
- }
- param_val = NULL;
- }
- crm_info("Configuration changes logged at: debug %d",
- cib_diff_loglevel - LOG_INFO);
-
/* read local config file */
return init_start();
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/messages.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- messages.c 31 Mar 2006 11:50:23 -0000 1.70
+++ messages.c 3 Apr 2006 10:01:35 -0000 1.71
@@ -1,4 +1,4 @@
-/* $Id: messages.c,v 1.70 2006/03/31 11:50:23 andrew Exp $ */
+/* $Id: messages.c,v 1.71 2006/04/03 10:01:35 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -54,6 +54,9 @@
enum cib_errors revision_check(crm_data_t *cib_update, crm_data_t *cib_copy,
int flags);
int get_revision(crm_data_t *xml_obj, int cur_revision);
+#define CIB_DIFF_LEVEL LOG_DEBUG
+unsigned int cib_diff_loglevel = CIB_DIFF_LEVEL+1;
+
enum cib_errors updateList(
crm_data_t *local_cib, crm_data_t *update_command, crm_data_t *failed,
int operation, const char *section);
@@ -139,7 +142,6 @@
return result;
}
-
enum cib_errors
cib_process_readwrite(
const char *op, int options, const char *section, crm_data_t *input,
@@ -158,6 +160,7 @@
}
if(safe_str_eq(op, CIB_OP_MASTER)) {
+ cib_diff_loglevel = CIB_DIFF_LEVEL;
if(cib_is_master == FALSE) {
crm_info("We are now in R/W mode");
cib_is_master = TRUE;
@@ -169,6 +172,7 @@
} else if(cib_is_master) {
crm_info("We are now in R/O mode");
+ cib_diff_loglevel = CIB_DIFF_LEVEL+1;
cib_is_master = FALSE;
}
------------------------------
Message: 2
Date: Mon, 3 Apr 2006 04:03:06 -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/crmd
Modified Files:
atest.c
Log Message:
random rubbish
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/atest.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- atest.c 2 Feb 2006 09:03:27 -0000 1.7
+++ atest.c 3 Apr 2006 10:03:06 -0000 1.8
@@ -1,4 +1,4 @@
-/* $Id: atest.c,v 1.7 2006/02/02 09:03:27 andrew Exp $ */
+/* $Id: atest.c,v 1.8 2006/04/03 10:03:06 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -63,123 +63,141 @@
GMainLoop* mainloop = NULL;
#define OPTARGS "V?f:"
-
+#include <bzlib.h>
int
main(int argc, char ** argv)
{
#if 0
- IPC_Channel* channels[2];
- crm_data_t *a_cib = NULL;
- HA_Message *cmd = NULL;
-
- crm_log_init(crm_system_name);
- set_crm_log_level(LOG_DEBUG_5-1);
-
- a_cib = string2xml("<cib_fragment section=\"status\"><cib
timestamp=\"1107940665\" generated=\"true\" cib_feature_revision=\"1\"
debug_source=\"do_lrm_query\"><configuration
timestamp=\"1107940665\"><crm_config/><nodes/><resources/><constraints/></configuration><status
timestamp=\"1107940665\"><node_state replace=\"lrm\"
id=\"f67904e0-4dfc-4db1-83a2-e930fc1d20f4\"
uname=\"c001n09\"><lrm><lrm_resources/><lrm_agents><lrm_agent class=\"stonith\"
type=\"apcmaster\" version=\"1\"/><lrm_agent class=\"stonith\"
type=\"apcsmart\" version=\"1\"/><lrm_agent class=\"stonith\" type=\"baytech\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"external\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"ibmhmc\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"meatware\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"null\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"nw_rpc100s\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"rcd_serial\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"riloe\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"rps10\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"ssh\"
version=\"1\"/><lrm_agent class=\"stonith\" type=\"wti_nps\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"portblock\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"ldirectord\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"db2\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"apache\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"Xinetd\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"WinPopup\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"WAS\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"ServeRAID\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"SendArp\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"Raid1\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"OCF\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"MailTo\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"LinuxSCSI\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"LVM\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"IPv6addr\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"IPsrcaddr\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"IPaddr2\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"IPaddr\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"ICP\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"Filesystem\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"Delay\"
version=\"1\"/><lrm_agent class=\"heartbeat\" type=\"AudibleAlarm\"
version=\"1\"/></lrm_agents><metatdata/></lrm></node_state></status></cib></cib_fragment>");
- /* createEmptyCib(); */
- cl_log_message(LOG_DEBUG, (HA_Message*)a_cib);
-
- if (ipc_channel_pair(channels) != IPC_OK) {
- cl_perror("Can't create ipc channel pair");
- exit(1);
- }
- G_main_add_IPC_Channel(G_PRIORITY_LOW,
- channels[1], FALSE,
- subsystem_msg_dispatch,
- (void*)process_atest_message,
- default_ipc_connection_destroy);
-
- /* send transition graph over IPC instead */
- cmd = create_request(CRM_OP_TRANSITION, a_cib, NULL,
- CRM_SYSTEM_TENGINE, CRM_SYSTEM_TENGINE, NULL);
-
- send_ipc_message(channels[0], cmd);
-
- mainloop = g_main_new(FALSE);
- crm_debug("Starting mainloop");
- g_main_run(mainloop);
+
+ int start = 0, length = 0, read_len = 0;
+ char *buffer = NULL;
+ int rc = 0;
+ FILE *file_strm = NULL;
+ const char *my_msg = "my first message";
+ char *compressed = NULL;
+ size_t compressed_len = 100;
+
+ char *decomp = NULL;
+ size_t decomp_len = 1;
+ size_t alloced_decomp_len = decomp_len;
+
+ cl_log_enable_stderr(1);
+
+ crm_malloc0(compressed, 100);
+
+ cl_compress(compressed, &compressed_len, my_msg, strlen(my_msg));
+ crm_err("Original: len: %zd, str: %s",
+ strlen(my_msg), my_msg);
+
+ crm_err("Compressed: len: %zd, str: %s",
+ compressed_len, compressed);
+
+ file_strm = fopen("foo.bz2", "w");
+ rc = fprintf(file_strm, "%s", compressed);
+ if(rc < 0) {
+ cl_perror("Cannot write output to foo.bz2");
+ }
+ fflush(file_strm);
+ fclose(file_strm);
-#else
- int flag = 0;
- FILE *xml_strm = NULL;
- const char *xml_file = "default.xml";
- crm_data_t *input = NULL;
- crm_data_t *output = NULL;
- int start = 0, length = 0, time_diff_ms = 0;
- longclock_t time_start = 0;
- longclock_t time_stop = 0;
- longclock_t time_diff = 0;
-
- crm_log_init(crm_system_name);
- set_crm_log_level(LOG_DEBUG);
-
- while (1) {
- flag = getopt(argc, argv, OPTARGS);
- if (flag == -1)
- break;
-
- switch(flag) {
- case 'f':
- xml_file = optarg;
- break;
- case 'V':
- cl_log_enable_stderr(TRUE);
- alter_debug(DEBUG_INC);
- break;
- default:
- printf("Argument code 0%o (%c)"
- " is not (?yet?) supported\n",
- flag, flag);
- break;
+ file_strm = fopen("foo.bz2", "r");
+ start = ftell(file_strm);
+ fseek(file_strm, 0L, SEEK_END);
+ length = ftell(file_strm);
+ fseek(file_strm, 0L, start);
+
+ CRM_ASSERT(start == ftell(file_strm));
+
+ crm_err("Reading %d bytes from file", length);
+ crm_malloc0(buffer, sizeof(char) * (length+1));
+ read_len = fread(buffer, sizeof(char), length, file_strm);
+ if(read_len != length) {
+ crm_err("Calculated and read bytes differ: %d vs. %d",
+ length, read_len);
+ crm_free(buffer);
+ buffer = NULL;
+
+ } else if(length <= 0) {
+ crm_info("foo.bz2 was not valid");
+ crm_free(buffer);
+ buffer = NULL;
+ }
+
+ while(alloced_decomp_len <= decomp_len) {
+ crm_err("Trying with buffer size: %zd", alloced_decomp_len);
+ if(decomp != NULL) {
+ crm_err("Found: %s", decomp);
+ crm_free(decomp);
}
+
+ decomp_len = 2*decomp_len;
+ crm_malloc0(decomp, (decomp_len+1)*sizeof(char));
+ alloced_decomp_len = decomp_len;
+
+ cl_decompress(decomp, &decomp_len, buffer, length);
+/* cl_decompress(decomp, &decomp_len, compressed, compressed_len);
*/
}
- xml_strm = fopen(xml_file, "r");
+ crm_err("Decompressed: len: %zd, str: %s", decomp_len, decomp);
+
+ return 0;
+#else
+ int rc = 0;
+ FILE *file_strm = NULL;
+ BZFILE *my_file = NULL;
+ char *my_msg = strdup("my first message");
+ unsigned int in = 0, out = 0;
+ char *decomp = NULL;
+ size_t decomp_len = 1;
+ size_t alloced_decomp_len = decomp_len;
+
+ cl_log_enable_stderr(1);
+ file_strm = fopen("foo.bz2", "w");
+ my_file = BZ2_bzWriteOpen(&rc, file_strm, 1, 0, 0);
+ if(rc != BZ_OK) {
+ crm_err("Failed: open (%d)", rc);
+ return 0;
+ }
+ BZ2_bzWrite(&rc, my_file, my_msg, strlen(my_msg));
+ if(rc != BZ_OK) {
+ crm_err("Failed: write (%d)", rc);
+ return 0;
+ }
+ BZ2_bzWriteClose(&rc, my_file, 0, &in, &out);
+ crm_err("In: %d, out: %d", in, out);
+ fclose(file_strm);
+ my_file = NULL;
+ file_strm = NULL;
+
+ while(alloced_decomp_len <= decomp_len) {
+ crm_err("Trying with buffer size: %zd", alloced_decomp_len);
+ if(decomp != NULL) {
+ crm_err("Found: %s", decomp);
+ crm_free(decomp);
+ }
+ if(my_file != NULL) {
+ crm_err("Closing...");
+ BZ2_bzReadClose(&rc, my_file);
+ fclose(file_strm);
+ }
+ file_strm = fopen("foo.bz2", "r");
+ my_file = BZ2_bzReadOpen(&rc, file_strm, 0, 0, NULL, 0);
+ if(rc != BZ_OK) {
+ crm_err("Failed: read open (%d)", rc);
+ }
- start = ftell(xml_strm);
- fseek(xml_strm, 0L, SEEK_END);
- length = ftell(xml_strm);
- fseek(xml_strm, 0L, start);
-
- if(xml_strm != NULL) {
- crm_debug("Reading: %s", xml_file);
- input = file2xml(xml_strm);
- } else {
- cl_perror("File not found: %s", xml_file);
- }
-
- time_start = time_longclock();
- output = copy_xml(input);
- time_stop = time_longclock();
-
- time_diff = sub_longclock(time_stop, time_start);
- time_diff_ms = longclockto_ms(time_diff);
- crm_warn("Copy %s (%d bytes): %dms", xml_file, length, time_diff_ms);
-
- time_start = time_longclock();
- free_xml(output);
- time_stop = time_longclock();
-
- time_diff = sub_longclock(time_stop, time_start);
- time_diff_ms = longclockto_ms(time_diff);
- crm_warn("Free %s (%d bytes): %dms", xml_file, length, time_diff_ms);
-
- time_start = time_longclock();
- write_xml_file(input, "/tmp/foo.xml");
- time_stop = time_longclock();
-
- time_diff = sub_longclock(time_stop, time_start);
- time_diff_ms = longclockto_ms(time_diff);
- crm_warn("Write %s (%d bytes): %dms", xml_file, length, time_diff_ms);
+ decomp_len = 2*decomp_len;
+ crm_malloc0(decomp, (decomp_len+1)*sizeof(char));
+ alloced_decomp_len = decomp_len;
+
+ decomp_len = BZ2_bzRead(&rc, my_file, decomp, decomp_len);
+ if(rc != BZ_OK) {
+ crm_err("Failed: read (%d)", rc);
+ }
+ }
+ crm_err("Decompressed: len: %zd, str: %s", decomp_len, decomp);
+ return 0;
#endif
- return 0;
}
-gboolean
-process_atest_message(HA_Message *msg, crm_data_t *xml_data, IPC_Channel
*sender)
-{
- crm_debug("made it");
- cl_log_message(LOG_DEBUG, msg);
- 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 29, Issue 6
*******************************************