Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
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 (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: include by sunjd from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Thu, 22 Jun 2006 03:14:23 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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/pengine Modified Files: clone.c Log Message: Use crm_realloc() to more effectivly create notify strings =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/clone.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- clone.c 13 Jun 2006 13:09:06 -0000 1.3 +++ clone.c 22 Jun 2006 09:14:23 -0000 1.4 @@ -1,4 +1,4 @@ -/* $Id: clone.c,v 1.3 2006/06/13 13:09:06 andrew Exp $ */ +/* $Id: clone.c,v 1.4 2006/06/22 09:14:23 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -126,6 +126,9 @@ if(node->details->online == FALSE || node->details->unclean || node->details->standby) { + crm_debug_2("%s: online=%d, unclean=%d, standby=%d", + node->details->uname, node->details->online, + node->details->unclean, node->details->standby); return FALSE; } return TRUE; @@ -920,40 +923,21 @@ expand_list(GListPtr list, int clones, char **rsc_list, char **node_list, char **uuid_list) { - int rsc_len = 0; - int node_len = 0; - int list_len = 100 * clones; - - char *rsc_list_s = NULL; - char *node_list_s = NULL; - const char *uname = NULL; const char *rsc_id = NULL; - const char *last_rsc_id = NULL; - clone_expand_reallocate: - if(rsc_list != NULL) { - crm_free(*rsc_list); - crm_malloc0(*rsc_list, list_len); - CRM_ASSERT(*rsc_list != NULL); - rsc_list_s = *rsc_list; - rsc_len = 0; - } - if(node_list != NULL) { - crm_free(*node_list); - crm_malloc0(*node_list, list_len); - CRM_ASSERT(*node_list != NULL); - node_list_s = *node_list; - node_len = 0; + CRM_CHECK(list != NULL, return); + if(rsc_list) { + CRM_CHECK(*rsc_list == NULL, *rsc_list = NULL); } - /* keep BEAM extra happy */ - if(rsc_list_s == NULL || node_list_s == NULL) { - return; + if(node_list) { + CRM_CHECK(*node_list == NULL, *node_list = NULL); } slist_iter(entry, notify_entry_t, list, lpc, + CRM_CHECK(entry != NULL, continue); rsc_id = entry->rsc->id; CRM_CHECK(rsc_id != NULL, rsc_id = "__none__"); uname = NULL; @@ -969,27 +953,29 @@ last_rsc_id = rsc_id; if(rsc_list != NULL) { - if(rsc_len + 1 + strlen(rsc_id) >= list_len) { - list_len *= 2; - goto clone_expand_reallocate; + int existing_len = 0; + int len = 2 + strlen(rsc_id); /* +1 space, +1 EOS */ + if(rsc_list && *rsc_list) { + existing_len = strlen(*rsc_list); } - sprintf(rsc_list_s, "%s ", rsc_id); - rsc_list_s += strlen(rsc_id); - rsc_len += strlen(rsc_id); - rsc_list_s++; - rsc_len++; + + crm_debug_5("Adding %s (%dc) at offset %d", + rsc_id, len-2, existing_len); + crm_realloc(*rsc_list, len + existing_len); + sprintf(*rsc_list + existing_len, "%s ", rsc_id); } if(node_list != NULL) { - if(node_len + 1 + strlen(uname) >= list_len) { - list_len *= 2; - goto clone_expand_reallocate; + int existing_len = 0; + int len = 2 + strlen(uname); + if(node_list && *node_list) { + existing_len = strlen(*node_list); } - sprintf(node_list_s, "%s ", uname); - node_list_s += strlen(uname); - node_len += strlen(uname); - node_list_s++; - node_len++; + + crm_debug_5("Adding %s (%dc) at offset %d", + uname, len-2, existing_len); + crm_realloc(*node_list, len + existing_len); + sprintf(*node_list + existing_len, "%s ", uname); } ); } ------------------------------ Message: 2 Date: Thu, 22 Jun 2006 03:15:41 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org 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 Log Message: Stand-alone version of the CIB for debugging. Start as: cib -s =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v retrieving revision 1.123 retrieving revision 1.124 diff -u -3 -r1.123 -r1.124 --- callbacks.c 29 May 2006 09:36:00 -0000 1.123 +++ callbacks.c 22 Jun 2006 09:15:40 -0000 1.124 @@ -1,4 +1,4 @@ -/* $Id: callbacks.c,v 1.123 2006/05/29 09:36:00 andrew Exp $ */ +/* $Id: callbacks.c,v 1.124 2006/06/22 09:15:40 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -51,6 +51,7 @@ extern GMainLoop* mainloop; extern gboolean cib_shutdown_flag; +extern gboolean stand_alone; extern void GHFunc_count_peers( gpointer key, gpointer value, gpointer user_data); @@ -819,7 +820,7 @@ local_notify = FALSE; } - if(needs_forward) { + if(needs_forward && stand_alone == FALSE) { HA_Message *forward_msg = cib_msg_copy(request, TRUE); ha_msg_add(forward_msg, F_CIB_DELEGATED, cib_our_uname); @@ -937,7 +938,7 @@ } } - if(needs_reply == FALSE) { + if(needs_reply == FALSE || stand_alone) { /* nothing more to do... * this was a non-originating slave update */ =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -3 -r1.43 -r1.44 --- main.c 17 May 2006 08:29:27 -0000 1.43 +++ main.c 22 Jun 2006 09:15:40 -0000 1.44 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.43 2006/05/17 08:29:27 andrew Exp $ */ +/* $Id: main.c,v 1.44 2006/06/22 09:15:40 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -54,6 +54,7 @@ #include <crm/dmalloc_wrapper.h> gboolean cib_shutdown_flag = FALSE; +gboolean stand_alone = FALSE; extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int ); @@ -75,7 +76,7 @@ ll_cluster_t *hb_conn = NULL; GTRIGSource *cib_writer = NULL; -#define OPTARGS "hV" +#define OPTARGS "hVs" static void cib_diskwrite_complete(gpointer userdata, int status, int signo, int exitcode) @@ -120,6 +121,9 @@ cl_log_enable_stderr(1); alter_debug(DEBUG_INC); break; + case 's': + stand_alone = TRUE; + break; case 'h': /* Help message */ usage(crm_system_name, LSB_EXIT_OK); break; @@ -192,13 +196,13 @@ init_start(void) { gboolean was_error = FALSE; - + if(stand_alone == FALSE) { hb_conn = ll_cluster_new("heartbeat"); if(cib_register_ha(hb_conn, CRM_SYSTEM_CIB) == FALSE) { crm_crit("Cannot sign in to heartbeat... terminating"); - fprintf(stderr, "Cannot sign in to heartbeat... terminating"); exit(1); } + } if(startCib(CIB_FILENAME) == FALSE){ crm_crit("Cannot start CIB... terminating"); @@ -225,6 +229,26 @@ crm_strdup(cib_channel_ro_synchronous), cib_client_connect_ro_synch, default_ipc_connection_destroy); + if(stand_alone) { + if(was_error) { + crm_err("Couldnt start"); + return 1; + } + cib_is_master = TRUE; + + /* Create the mainloop and run it... */ + mainloop = g_main_new(FALSE); + crm_info("Starting %s mainloop", crm_system_name); + +/* Gmain_timeout_add(crm_get_msec("10s"), cib_msg_timeout, NULL); */ +/* Gmain_timeout_add( */ +/* crm_get_msec(cib_stat_interval), cib_stats, NULL); */ + + g_main_run(mainloop); + return_to_orig_privs(); + return 0; + } + if(was_error == FALSE) { crm_debug_3("Be informed of CRM Client Status changes"); if (HA_OK != hb_conn->llc_ops->set_cstatus_callback( ------------------------------ Message: 3 Date: Thu, 22 Jun 2006 04:27:16 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: include by sunjd from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : sunjd Host : Project : linux-ha Module : include Dir : linux-ha/include/lrm Modified Files: raexec.h Log Message: tweak error code =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/include/lrm/raexec.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- raexec.h 26 Oct 2005 11:34:49 -0000 1.15 +++ raexec.h 22 Jun 2006 10:27:16 -0000 1.16 @@ -26,8 +26,8 @@ /* Uniform return value of executing RA */ enum UNIFORM_RET_EXECRA { - EXECRA_EXEC_UNKNOWN_ERROR = 152, - EXECRA_NO_RA = 151, + EXECRA_EXEC_UNKNOWN_ERROR = -2, + EXECRA_NO_RA = -1, EXECRA_OK = 0, EXECRA_UNKNOWN_ERROR = 1, EXECRA_INVALID_PARAM = 2, ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 31, Issue 80 ********************************************