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: include by andrew from 
      ([email protected])
   2. Linux-HA CVS: crm by andrew from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Tue, 10 Jan 2006 06:46:41 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/crm


Modified Files:
        crm.h msg_xml.h 


Log Message:
Timerless elections
 - required nodes to send "no-votes" when they loose.
 - nodes can no longer ignore their own votes or do vote compression
 - elections are owned and unique. we must recieve 1 no-vote from each
   node in the cluster before continuing 
Have all shutdowns go via the PE
 - fixes the SimulStop case where resources were stopped out of order
 - required "shutdown" status to no longer be considered during elections
 - the TE needs to be invoked even if the DC is shutting down
 - DC's shut themselves down and the cluster can elect a new one if it needs to

XML_CIB_ATTR_SHUTDOWN is now checked for non-zero instead of NULL to decide if
 a node wants to shut down.
 - means we can do away with the XML_CIB_ATTR_CLEAR_SHUTDOWN and the special 
   code for it in the CIB

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/crm/crm.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- crm.h       25 Oct 2005 13:52:40 -0000      1.84
+++ crm.h       10 Jan 2006 13:46:41 -0000      1.85
@@ -1,4 +1,4 @@
-/* $Id: crm.h,v 1.84 2005/10/25 13:52:40 andrew Exp $ */
+/* $Id: crm.h,v 1.85 2006/01/10 13:46:41 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -118,6 +118,7 @@
 #define CRM_OP_RETRIVE_CIB     "retrieve_cib"
 #define CRM_OP_PING            "ping"
 #define CRM_OP_VOTE            "vote"
+#define CRM_OP_NOVOTE          "no-vote"
 #define CRM_OP_HELLO           "hello"
 #define CRM_OP_HBEAT           "dc_beat"
 #define CRM_OP_PECALC          "pe_calc"
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/crm/msg_xml.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- msg_xml.h   26 Sep 2005 07:48:53 -0000      1.45
+++ msg_xml.h   10 Jan 2006 13:46:41 -0000      1.46
@@ -1,4 +1,4 @@
-/* $Id: msg_xml.h,v 1.45 2005/09/26 07:48:53 andrew Exp $ */
+/* $Id: msg_xml.h,v 1.46 2006/01/10 13:46:41 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -29,6 +29,8 @@
 #define F_CRM_VERSION                  XML_ATTR_VERSION
 #define F_CRM_ORIGIN                   "origin"
 #define F_CRM_JOIN_ID                  "join_id"
+#define F_CRM_ELECTION_ID              "election-id"
+#define F_CRM_ELECTION_OWNER           "election-owner"
 
 /*---- Common tags/attrs */
 #define XML_ATTR_TAGNAME               F_XML_TAGNAME
@@ -160,9 +162,7 @@
 #define XML_CIB_ATTR_HASTATE           "ha"
 
 #define XML_CIB_ATTR_SHUTDOWN          "shutdown"
-#define XML_CIB_ATTR_CLEAR_SHUTDOWN    "clear_shutdown"
 #define XML_CIB_ATTR_STONITH           "stonith"
-#define XML_CIB_ATTR_CLEAR_STONITH     "clear_stonith"
 
 #define XML_LRM_ATTR_TASK              "operation"
 #define XML_LRM_ATTR_TASK_KEY          "operation_key"




------------------------------

Message: 2
Date: Tue, 10 Jan 2006 06:46:45 -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/crmd


Modified Files:
        callbacks.c ccm.c control.c crmd_fsa.h crmd_messages.h 
        crmd_utils.h election.c fsa.c fsa_defines.h fsa_matrix.h 
        fsa_proto.h join_dc.c lrm.c messages.c tengine.c utils.c 


Log Message:
Timerless elections
 - required nodes to send "no-votes" when they loose.
 - nodes can no longer ignore their own votes or do vote compression
 - elections are owned and unique. we must recieve 1 no-vote from each
   node in the cluster before continuing 
Have all shutdowns go via the PE
 - fixes the SimulStop case where resources were stopped out of order
 - required "shutdown" status to no longer be considered during elections
 - the TE needs to be invoked even if the DC is shutting down
 - DC's shut themselves down and the cluster can elect a new one if it needs to

XML_CIB_ATTR_SHUTDOWN is now checked for non-zero instead of NULL to decide if
 a node wants to shut down.
 - means we can do away with the XML_CIB_ATTR_CLEAR_SHUTDOWN and the special 
   code for it in the CIB

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/callbacks.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -3 -r1.94 -r1.95
--- callbacks.c 7 Jan 2006 21:20:01 -0000       1.94
+++ callbacks.c 10 Jan 2006 13:46:41 -0000      1.95
@@ -95,6 +95,8 @@
 
        CRM_DEV_ASSERT(from != NULL);
 
+       crm_debug_2("HA[inbound]: %s from %s", op, from);
+
        if(fsa_membership_copy == NULL) {
                crm_debug("Ignoring HA messages until we are"
                          " connected to the CCM (%s op from %s)", op, from);
@@ -152,22 +154,18 @@
                crm_log_message_adv(LOG_DEBUG_4, "HA[inbound]: ignore", msg);
                return;
 
-       } else if(safe_str_eq(from, fsa_our_uname)
-                 && safe_str_eq(op, CRM_OP_VOTE)) {
-               crm_log_message_adv(LOG_DEBUG_4, "HA[inbound]", msg);
-               crm_debug_2("Ignoring our own vote [F_SEQ=%s]: own vote", seq);
-               return;
-               
        } else if(AM_I_DC && safe_str_eq(op, CRM_OP_HBEAT)) {
                crm_debug_2("Ignoring our own heartbeat [F_SEQ=%s]", seq);
                crm_log_message_adv(LOG_DEBUG_4, "HA[inbound]: own heartbeat", 
msg);
                return;
 
        } else {
-               crm_debug_3("Processing message");
+               int msg_id = -1;
                crm_log_message_adv(LOG_MSG, "HA[inbound]", msg);
                new_input = new_ha_msg_input(msg);
-               register_fsa_input(C_HA_MESSAGE, I_ROUTER, new_input);
+               msg_id = register_fsa_input(C_HA_MESSAGE, I_ROUTER, new_input);
+               crm_debug_2("Submitted %s from %s for processing (job=%d)",
+                           op, from, msg_id);
        }
 
        
@@ -298,9 +296,8 @@
 
        /* this node is taost */
        update = create_node_state(
-               node, node, status, NULL, NULL, NULL, NULL, __FUNCTION__);
-       
-       crm_xml_add(update, XML_CIB_ATTR_CLEAR_SHUTDOWN, XML_BOOLEAN_TRUE);
+               node, status, XML_BOOLEAN_NO, OFFLINESTATUS,
+               CRMD_STATE_INACTIVE, NULL, TRUE, __FUNCTION__);
        crm_xml_add(update, XML_CIB_ATTR_REPLACE, XML_TAG_TRANSIENT_NODEATTRS);
 
        /* this change should not be broadcast */
@@ -314,10 +311,10 @@
 crmd_client_status_callback(const char * node, const char * client,
                 const char * status, void * private)
 {
-       const char    *join = NULL;
-       const char   *extra = NULL;
-       crm_data_t *  update = NULL;
-
+       const char *join = NULL;
+       crm_data_t *update = NULL;
+       gboolean clear_shutdown = FALSE;
+       
        crm_debug_3("received callback");
        if(safe_str_neq(client, CRM_SYSTEM_CRMD)) {
                return;
@@ -325,12 +322,12 @@
 
        if(safe_str_eq(status, JOINSTATUS)){
                status = ONLINESTATUS;
-/*             extra  = XML_CIB_ATTR_CLEAR_SHUTDOWN; */
+/*             clear_shutdown = TRUE; */
 
        } else if(safe_str_eq(status, LEAVESTATUS)){
                status = OFFLINESTATUS;
                join   = CRMD_STATE_INACTIVE;
-               extra  = XML_CIB_ATTR_CLEAR_SHUTDOWN;
+               clear_shutdown = TRUE;
        }
        
        set_bit_inplace(fsa_input_register, R_PEER_DATA);
@@ -356,11 +353,10 @@
                crm_data_t *fragment = NULL;
                crm_debug_3("Got client status callback");
                update = create_node_state(
-                       node, node, NULL, NULL, status, join, NULL,
-                       __FUNCTION__);
-               
-               crm_xml_add(update, extra, XML_BOOLEAN_TRUE);
-               if(safe_str_eq(extra, XML_CIB_ATTR_CLEAR_SHUTDOWN)) {
+                       node, NULL, NULL, status, join,
+                       NULL, clear_shutdown, __FUNCTION__);
+
+               if(clear_shutdown) {
                        crm_xml_add(update, XML_CIB_ATTR_REPLACE,
                                    XML_TAG_TRANSIENT_NODEATTRS);
                }
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/ccm.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- ccm.c       24 Oct 2005 07:37:46 -0000      1.91
+++ ccm.c       10 Jan 2006 13:46:41 -0000      1.92
@@ -1,4 +1,4 @@
-/* $Id: ccm.c,v 1.91 2005/10/24 07:37:46 andrew Exp $ */
+/* $Id: ccm.c,v 1.92 2006/01/10 13:46:41 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -644,9 +644,8 @@
        crm_debug("Updating %s: %s/%s",
                  node_uname, data->state, data->join);
 
-       tmp1 = create_node_state(node_uname, node_uname,
-                                NULL, data->state, NULL, data->join,
-                                NULL, __FUNCTION__);
+       tmp1 = create_node_state(node_uname, NULL, data->state, NULL,
+                                data->join, NULL, FALSE, __FUNCTION__);
 
        add_node_copy(data->updates, tmp1);
        free_xml(tmp1);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/control.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -3 -r1.103 -r1.104
--- control.c   7 Jan 2006 21:20:01 -0000       1.103
+++ control.c   10 Jan 2006 13:46:42 -0000      1.104
@@ -148,7 +148,6 @@
            enum crmd_fsa_input current_input,
            fsa_data_t *msg_data)
 {
-       enum crmd_fsa_input next_input = I_NULL;
        HA_Message *msg = NULL;
        
        crm_info("Sending shutdown request to DC: %s", crm_str(fsa_our_dc));
@@ -159,7 +158,12 @@
 /*     set_bit_inplace(fsa_input_register, R_STAYDOWN); */
        
        if(send_request(msg, NULL) == FALSE) {
-               next_input = I_ERROR;
+               if(AM_I_DC) {
+                       crm_info("Processing shutdown locally");
+               } else {
+                       register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
+               }
+               
 #if 0
                /* this shouldnt be required */
        } else {
@@ -167,7 +171,7 @@
 #endif
        }
 
-       return next_input;
+       return I_NULL;
 }
 
 /*      A_EXIT_0, A_EXIT_1     */
@@ -433,10 +437,21 @@
        enum crmd_fsa_input current_input,
        fsa_data_t *msg_data)
 {
+
        if(g_hash_table_size(shutdown_ops) > 0) {
                crm_err("%d stop operations outstanding at exit",
                        g_hash_table_size(shutdown_ops));
        }
+
+       if(is_set(fsa_input_register, R_CIB_CONNECTED)) {
+               crm_data_t *tmp1 = NULL;
+               crm_info("Updating node_status entry");
+               tmp1 = create_node_state(fsa_our_uname, NULL, NULL, NULL,
+                                        NULL, NULL, TRUE, __FUNCTION__);
+               update_local_cib(create_cib_fragment(tmp1, XML_CIB_TAG_STATUS));
+               free_xml(tmp1);
+       }
+       
        
        return I_NULL;
 }
@@ -556,16 +571,17 @@
                        getenv("HA_"KEY_KEEPALIVE));
        }
        
-       election_timeout->period_ms   = dc_heartbeat->period_ms * 6;
+       election_timeout->period_ms   = crm_get_msec("1min");
+       /*dc_heartbeat->period_ms * 6;*/
        integration_timer->period_ms  = dc_heartbeat->period_ms * 6;
        finalization_timer->period_ms = dc_heartbeat->period_ms * 6;
        integration_timer->period_ms  = crm_get_msec("5min");
        finalization_timer->period_ms = crm_get_msec("5min");
        
        if(election_trigger->period_ms < 1
-          || election_trigger->period_ms > election_timeout->period_ms) {
+          || election_trigger->period_ms > dc_heartbeat->period_ms * 12) {
                /* sensible default */
-               election_trigger->period_ms = election_timeout->period_ms * 2;
+               election_trigger->period_ms = dc_heartbeat->period_ms * 12;
        }
        
        if(shutdown_escalation_timer->period_ms < 1
@@ -590,21 +606,12 @@
                        register_fsa_input_before(C_SHUTDOWN, I_ERROR, NULL);
 
                } else {
+                       crm_info("Requesting shutdown");
                        set_bit_inplace(fsa_input_register, R_SHUTDOWN);
-/*                     set_bit_inplace(fsa_input_register, R_STAYDOWN); */
-
-                       /* if we ever win an election we're the last man 
standing */
-                       election_timeout->fsa_input = I_STOP;
+                       register_fsa_input(C_SHUTDOWN,I_SHUTDOWN,NULL);
 
-                       if(is_set(fsa_input_register, R_SHUTDOWN)) {
-                               /* cant rely on this... */
-                               crm_timer_start(shutdown_escalation_timer);
-                               register_fsa_input(C_SHUTDOWN,I_SHUTDOWN,NULL);
-
-                       } else {
-                               crm_err("Could not set R_SHUTDOWN");
-                               exit(LSB_EXIT_ENOTSUPPORTED);
-                       }
+                       /* cant rely on this... */
+                       crm_timer_start(shutdown_escalation_timer);
                }
                
        } else {
@@ -672,6 +679,14 @@
        }
        crm_info("FSA Hostname: %s", fsa_our_uname);
 
+       crm_debug_3("Finding our node uuid");
+       fsa_our_uuid = get_uuid(fsa_cluster_conn, fsa_our_uname);
+       if(safe_str_eq(fsa_our_uname, fsa_our_uuid)) {
+               crm_err("get_uuid_by_name() failed");
+               return FALSE;
+       }
+       crm_info("FSA UUID: %s", fsa_our_uuid);
+               
        /* Async get client status information in the cluster */
        crm_debug_3("Requesting an initial dump of CRMD client_status");
        fsa_cluster_conn->llc_ops->client_status(
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/crmd_fsa.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- crmd_fsa.h  20 Oct 2005 13:48:31 -0000      1.45
+++ crmd_fsa.h  10 Jan 2006 13:46:42 -0000      1.46
@@ -1,4 +1,4 @@
-/* $Id: crmd_fsa.h,v 1.45 2005/10/20 13:48:31 andrew Exp $ */
+/* $Id: crmd_fsa.h,v 1.46 2006/01/10 13:46:42 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -114,6 +114,7 @@
 extern cib_t         *fsa_cib_conn;
 
 extern const char *fsa_our_uname;
+extern const char *fsa_our_uuid;
 extern char      *fsa_pe_ref; /* the last invocation of the PE */
 extern char       *fsa_our_dc;
 extern char      *fsa_our_dc_version;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/crmd_messages.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- crmd_messages.h     17 Oct 2005 19:13:47 -0000      1.28
+++ crmd_messages.h     10 Jan 2006 13:46:42 -0000      1.29
@@ -35,7 +35,7 @@
 
 #define register_fsa_error(cause, input, new_data) 
register_fsa_error_adv(cause, input, msg_data, new_data, __FUNCTION__)
 
-extern void register_fsa_input_adv(
+extern int register_fsa_input_adv(
        enum crmd_fsa_cause cause, enum crmd_fsa_input input,
        void *data, long long with_actions,
        gboolean prepend, const char *raised_from);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/crmd_utils.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- crmd_utils.h        20 Oct 2005 13:48:31 -0000      1.20
+++ crmd_utils.h        10 Jan 2006 13:46:42 -0000      1.21
@@ -1,4 +1,4 @@
-/* $Id: crmd_utils.h,v 1.20 2005/10/20 13:48:31 andrew Exp $ */
+/* $Id: crmd_utils.h,v 1.21 2006/01/10 13:46:42 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -47,10 +47,9 @@
 extern gboolean crm_timer_popped(gpointer data);
 
 extern crm_data_t *create_node_state(
-       const char *uuid, const char *uname,
-       const char *ha_state, const char *ccm_state,
+       const char *uname, const char *ha_state, const char *ccm_state,
        const char *crmd_state, const char *join_state, const char *exp_state,
-       const char *src);
+       gboolean clear_shutdown, const char *src);
 
 extern void create_node_entry(
        const char *uuid, const char *uname, const char *type);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/election.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -3 -r1.100 -r1.101
--- election.c  22 Nov 2005 02:40:24 -0000      1.100
+++ election.c  10 Jan 2006 13:46:42 -0000      1.101
@@ -27,10 +27,13 @@
 #include <crmd_messages.h>
 #include <crmd_callbacks.h>
 #include <clplumbing/Gmain_timeout.h>
+#include <clplumbing/cl_uuid.h>
 
 #include <crm/dmalloc_wrapper.h>
 
+GHashTable *voted = NULL;
 uint highest_born_on = -1;
+static int current_election_id = 1;
 
 /*     A_ELECTION_VOTE */
 enum crmd_fsa_input
@@ -76,10 +79,9 @@
                CRM_OP_VOTE, NULL, NULL,
                CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
 
-       if(is_set(fsa_input_register, R_SHUTDOWN)) {
-               crm_warn("Not voting in election, we're shutting down");
-               cl_msg_remove(vote, F_CRM_VERSION);
-       }
+       current_election_id++;
+       ha_msg_add(vote, F_CRM_ELECTION_OWNER, fsa_our_uuid);
+       ha_msg_add_int(vote, F_CRM_ELECTION_ID, current_election_id);
 
        send_request(vote, NULL);
        if(cur_state == S_ELECTION || cur_state == S_RELEASE_DC) {
@@ -90,7 +92,6 @@
                        fsa_state2string(cur_state));
        }
        
-       
        return I_NULL;
 }
 
@@ -130,6 +131,40 @@
                unsigned int winning_bornon;
 };
 
+enum crmd_fsa_input
+do_election_check(long long action,
+                      enum crmd_fsa_cause cause,
+                      enum crmd_fsa_state cur_state,
+                      enum crmd_fsa_input current_input,
+                 fsa_data_t *msg_data)
+{
+       int voted_size = g_hash_table_size(voted);
+       int num_members = g_hash_table_size(fsa_membership_copy->members);
+       
+       /* in the case of #voted > #members, it is better to
+        *   wait for the timeout and give the cluster time to
+        *   stabilize
+        */
+       if(fsa_state != S_ELECTION) {
+               crm_debug("Ignore election check: we not in an election");
+
+       } else if(voted_size == num_members) {
+               /* we won and everyone has voted */
+               crm_timer_stop(election_timeout);
+               register_fsa_input(C_FSA_INTERNAL, I_ELECTION_DC, NULL);
+               crm_debug("Destroying voted hash");
+               g_hash_table_destroy(voted);
+               voted = NULL;
+               
+       } else {
+               crm_info("Still waiting on %d non-votes (%d total)",
+                        num_members - voted_size, num_members);
+       }
+
+       return I_NULL;
+}
+
+
 /*     A_ELECTION_COUNT        */
 enum crmd_fsa_input
 do_election_count_vote(long long action,
@@ -138,17 +173,17 @@
                       enum crmd_fsa_input current_input,
                       fsa_data_t *msg_data)
 {
+       int election_id = -1;
        gboolean we_loose = FALSE;
-       ha_msg_input_t *vote = fsa_typed_data(fsa_dt_ha_msg);
        enum crmd_fsa_input election_result = I_NULL;
-       const char *vote_from    = cl_get_string(vote->msg, F_CRM_HOST_FROM);
-       const char *your_version = cl_get_string(vote->msg, F_CRM_VERSION);
-       oc_node_t *our_node = NULL, * your_node = NULL;
-
-       if(vote_from == NULL || strcmp(vote_from, fsa_our_uname) == 0) {
-               /* dont count our own vote */
-               return election_result;
-       }
+       oc_node_t *our_node = NULL, *your_node = NULL;
+       ha_msg_input_t *vote = fsa_typed_data(fsa_dt_ha_msg);
+       const char *op            = cl_get_string(vote->msg, F_CRM_TASK);
+       const char *vote_from     = cl_get_string(vote->msg, F_CRM_HOST_FROM);
+       const char *your_version  = cl_get_string(vote->msg, F_CRM_VERSION);
+       const char *election_owner= cl_get_string(vote->msg, 
F_CRM_ELECTION_OWNER);
+       
+       ha_msg_value_int(vote->msg, F_CRM_ELECTION_ID, &election_id);
 
        if(fsa_membership_copy == NULL) {
                /* if the membership copy is NULL we REALLY shouldnt be voting
@@ -164,37 +199,63 @@
                your_node = (oc_node_t*)
                        
g_hash_table_lookup(fsa_membership_copy->members,vote_from);
        }
-       
-       if(your_node == NULL) {
-               crm_debug("Election ignore: The other side doesnt exist in 
CCM.");
-               return I_NULL;
-               
-               /* if your_version == 0, then they're shutting down too */
-       } else if(is_set(fsa_input_register, R_SHUTDOWN)) {
-               if(your_version != NULL) {
-                       crm_info("Election fail: we are shutting down");
-                       we_loose = TRUE;
-                       
-               } else {
-                       /* pretend nothing happened, they want to shutdown too*/
-                       crm_info("Election ignore: they are shutting down too");
-                       return I_NULL;
+
+       if(voted == NULL) {
+               crm_debug("Created voted hash");
+               voted = g_hash_table_new_full(
+                       g_str_hash, g_str_equal,
+                       g_hash_destroy_str, g_hash_destroy_str);
+       }
+
+       /* update the list of nodes that have voted */
+       if(your_node != NULL) {
+               char *op_copy = NULL;
+               char *uname_copy = NULL;
+               if(safe_str_eq(op, CRM_OP_NOVOTE)) {
+                       if(safe_str_neq(fsa_our_uuid,election_owner)) {
+                               crm_err("Recieved %s for %s (we are %s)",
+                                       op, election_owner, fsa_our_uuid);
+                       }       
+               }
+               if(safe_str_eq(fsa_our_uuid, election_owner)) {
+                       if(election_id != current_election_id) {
+                               crm_debug("Ignore old novote from %s: %d vs. 
%d",
+                                         your_node->node_uname,
+                                         election_id, current_election_id);
+                       }
+                       uname_copy = crm_strdup(your_node->node_uname);
+                       op_copy = crm_strdup(op);
+                       g_hash_table_replace(voted, uname_copy, op_copy);
+                       crm_info("Updated voted hash for %s to %s", 
uname_copy,op_copy);
                }
                
-       } else if(our_node == NULL
+       } else {
+               crm_debug("Election ignore: The other side doesnt exist in 
CCM.");
+               return I_NULL;
+       }
+       
+       if(vote_from == NULL || safe_str_eq(vote_from, fsa_our_uname)) {
+               /* dont count our own vote */
+               crm_info("Election ignore: our %s", op);
+               return I_NULL;
+
+       } else if(safe_str_eq(op, CRM_OP_NOVOTE)) {
+               crm_info("Election ignore: no-vote from %s", vote_from);
+               return I_NULL;
+       }
+
+       crm_info("Election check: %s from %s", op, vote_from);
+       if(our_node == NULL
                || fsa_membership_copy->last_event == OC_EV_MS_EVICTED) {
                crm_info("Election fail: we dont exist in CCM");
                we_loose = TRUE;
-               
-       } else if(your_version == NULL) {
-               crm_info("Election pass: they are shutting down");
 
        } else if(compare_version(your_version, CRM_FEATURE_SET) < 0) {
-               crm_debug("Election fail: version");
+               crm_info("Election fail: version");
                we_loose = TRUE;
                
        } else if(compare_version(your_version, CRM_FEATURE_SET) > 0) {
-               crm_debug("Election pass: version");
+               crm_info("Election pass: version");
                
        } else if(your_node->node_born_on < our_node->node_born_on) {
                crm_debug("Election fail: born_on");
@@ -216,8 +277,24 @@
        }
 
        if(we_loose) {
+               gboolean vote_sent = FALSE;
+               HA_Message *novote = create_request(
+                       CRM_OP_NOVOTE, NULL, vote_from,
+                       CRM_SYSTEM_CRMD, CRM_SYSTEM_CRMD, NULL);
+               cl_uuid_t vote_uuid_s;
+               char *vote_uuid = NULL;
+               if(cl_get_uuid(vote->msg, F_ORIGUUID, &vote_uuid_s) == HA_OK) {
+                       crm_malloc0(vote_uuid, sizeof(char)*100);
+                       cl_uuid_unparse(&vote_uuid_s, vote_uuid);
+               }
+
+               if(vote_uuid == NULL) {
+                       cl_log_message(LOG_ERR, vote->msg);
+               }
+               
                crm_timer_stop(election_timeout);
-               crm_debug("Election lost to %s", vote_from);
+               crm_debug("Election lost to %s (%s/%d)",
+                         vote_from, vote_uuid, election_id);
                if(fsa_input_register & R_THE_DC) {
                        crm_debug_3("Give up the DC to %s", vote_from);
                        election_result = I_RELEASE_DC;
@@ -228,6 +305,13 @@
                        
                }
 
+               ha_msg_add(novote, F_CRM_ELECTION_OWNER, vote_uuid);
+               ha_msg_add_int(novote, F_CRM_ELECTION_ID, election_id);
+               
+               vote_sent = send_request(novote, NULL);
+               CRM_DEV_ASSERT(vote_sent);
+               crm_free(vote_uuid);
+               
        } else {
                if(cur_state == S_PENDING) {
                        crm_debug("Election ignore: We already lost the 
election");
@@ -237,9 +321,11 @@
                        crm_info("Election won over %s", vote_from);
                        election_result = I_ELECTION;
                }
+               crm_debug("Destroying voted hash");
+               g_hash_table_destroy(voted);
+               voted = NULL;
        }
        
-
        register_fsa_input(C_FSA_INTERNAL, election_result, NULL);
        return I_NULL;
 }
@@ -287,6 +373,12 @@
 
        crm_free(fsa_our_dc_version);
        fsa_our_dc_version = crm_strdup(CRM_FEATURE_SET);
+
+       if(voted != NULL) {
+               crm_debug_2("Destroying voted hash");
+               g_hash_table_destroy(voted);
+               voted = NULL;
+       }
        
        set_bit_inplace(fsa_input_register, R_JOIN_OK);
        set_bit_inplace(fsa_input_register, R_INVOKE_PE);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/fsa.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -3 -r1.126 -r1.127
--- fsa.c       19 Dec 2005 16:54:43 -0000      1.126
+++ fsa.c       10 Jan 2006 13:46:42 -0000      1.127
@@ -177,6 +177,7 @@
 volatile long long       fsa_input_register;
 volatile long long       fsa_actions = A_NOTHING;
 const char     *fsa_our_uname = NULL;
+const char     *fsa_our_uuid = NULL;
 char          *fsa_our_dc = NULL;
 char          *fsa_our_dc_version = NULL;
 cib_t  *fsa_cib_conn = NULL;
@@ -424,6 +425,7 @@
                 */
                else IF_FSA_ACTION(A_DC_TAKEOVER,        do_dc_takeover)
                else IF_FSA_ACTION(A_DC_RELEASE,         do_dc_release)
+               else IF_FSA_ACTION(A_ELECTION_CHECK,     do_election_check)
                else IF_FSA_ACTION(A_ELECTION_START,     do_election_vote)
                else IF_FSA_ACTION(A_DC_JOIN_OFFER_ALL,  do_dc_join_offer_all)
                else IF_FSA_ACTION(A_DC_JOIN_OFFER_ONE,  do_dc_join_offer_all)
@@ -653,6 +655,11 @@
                        
                case S_IDLE:
                        dump_rsc_info();
+                       if(is_set(fsa_input_register, R_SHUTDOWN)){
+                               crm_info("(Re)Issuing shutdown request now"
+                                        " that we are the DC");
+                               set_bit_inplace(tmp, A_SHUTDOWN_REQ);
+                       }
                        if(recheck_timer->period_ms > 0) {
                                crm_timer_start(recheck_timer);
                        }
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/fsa_defines.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- fsa_defines.h       16 Sep 2005 16:45:58 -0000      1.40
+++ fsa_defines.h       10 Jan 2006 13:46:42 -0000      1.41
@@ -1,4 +1,4 @@
-/* $Id: fsa_defines.h,v 1.40 2005/09/16 16:45:58 andrew Exp $ */
+/* $Id: fsa_defines.h,v 1.41 2006/01/10 13:46:42 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -331,6 +331,7 @@
 #define        A_EXIT_1                0x0000000080000000ULL
 
 #define        A_SHUTDOWN_REQ          0x0000000100000000ULL
+#define        A_ELECTION_CHECK        0x0000000200000000ULL
 
 /* -- CCM actions -- */
 #define        A_CCM_CONNECT           0x0000001000000000ULL
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/fsa_matrix.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- fsa_matrix.h        29 May 2005 17:11:51 -0000      1.62
+++ fsa_matrix.h        10 Jan 2006 13:46:42 -0000      1.63
@@ -405,20 +405,20 @@
 
 /* Got an I_SHUTDOWN */
        {
-               /* S_IDLE               ==> */  S_RELEASE_DC,
-               /* S_ELECTION           ==> */  S_RELEASE_DC,
-               /* S_INTEGRATION        ==> */  S_RELEASE_DC,
-               /* S_FINALIZE_JOIN      ==> */  S_RELEASE_DC,
+               /* S_IDLE               ==> */  S_POLICY_ENGINE,
+               /* S_ELECTION           ==> */  S_ELECTION,
+               /* S_INTEGRATION        ==> */  S_INTEGRATION,
+               /* S_FINALIZE_JOIN      ==> */  S_FINALIZE_JOIN,
                /* S_NOT_DC             ==> */  S_NOT_DC,
-               /* S_POLICY_ENGINE      ==> */  S_RELEASE_DC,
+               /* S_POLICY_ENGINE      ==> */  S_POLICY_ENGINE,
                /* S_RECOVERY           ==> */  S_STOPPING,
                /* S_RELEASE_DC         ==> */  S_RELEASE_DC,
                /* S_STARTING           ==> */  S_STOPPING,
                /* S_PENDING            ==> */  S_PENDING,
                /* S_STOPPING           ==> */  S_STOPPING,
                /* S_TERMINATE          ==> */  S_TERMINATE,
-               /* S_TRANSITION_ENGINE  ==> */  S_RELEASE_DC,
-               /* S_HALT               ==> */  S_RELEASE_DC,
+               /* S_TRANSITION_ENGINE  ==> */  S_POLICY_ENGINE,
+               /* S_HALT               ==> */  S_ELECTION,
        },
 
 /* Got an I_STOP */
@@ -670,7 +670,7 @@
 /* Got an I_CCM_EVENT */
        {
                /* S_IDLE               ==> */  A_CCM_EVENT|A_CCM_UPDATE_CACHE,
-               /* S_ELECTION           ==> */  A_CCM_EVENT|A_CCM_UPDATE_CACHE,
+               /* S_ELECTION           ==> */  
A_CCM_EVENT|A_CCM_UPDATE_CACHE|A_ELECTION_CHECK,
                /* S_INTEGRATION        ==> */  A_CCM_EVENT|A_CCM_UPDATE_CACHE,
                /* S_FINALIZE_JOIN      ==> */  A_CCM_EVENT|A_CCM_UPDATE_CACHE,
                /* S_NOT_DC             ==> */  A_CCM_EVENT|A_CCM_UPDATE_CACHE,
@@ -796,8 +796,8 @@
 /* Got an I_ELECTION_DC */
        {
                /* S_IDLE               ==> */  A_WARN|A_ELECTION_VOTE,
-               /* S_ELECTION           ==> */  
A_LOG|A_DC_TAKEOVER|A_PE_START|A_TE_START|A_DC_JOIN_OFFER_ALL|A_DC_TIMER_STOP|A_ELECTION_VOTE,
-               /* S_INTEGRATION        ==> */  A_WARN|A_ELECTION_VOTE,
+               /* S_ELECTION           ==> */  
A_LOG|A_DC_TAKEOVER|A_PE_START|A_TE_START|A_DC_JOIN_OFFER_ALL|A_DC_TIMER_STOP,
+               /* S_INTEGRATION        ==> */  A_WARN,
                /* S_FINALIZE_JOIN      ==> */  A_WARN|A_ELECTION_VOTE,
                /* S_NOT_DC             ==> */  A_LOG|A_ELECTION_VOTE,
                /* S_POLICY_ENGINE      ==> */  A_WARN|A_ELECTION_VOTE,
@@ -964,7 +964,7 @@
                /* S_NOT_DC             ==> */  A_WARN,
                /* S_POLICY_ENGINE      ==> */  A_WARN,
                /* S_RECOVERY           ==> */  A_WARN,
-               /* S_RELEASE_DC         ==> */  A_LOG|A_DC_TIMER_START,
+               /* S_RELEASE_DC         ==> */  A_LOG,
                /* S_STARTING           ==> */  A_WARN,
                /* S_PENDING            ==> */  A_LOG,
                /* S_STOPPING           ==> */  A_WARN,
@@ -1029,20 +1029,20 @@
 
 /* Got an I_SHUTDOWN */
        {
-               /* S_IDLE               ==> */  O_RELEASE|A_ELECTION_START,
-               /* S_ELECTION           ==> */  O_RELEASE,
-               /* S_INTEGRATION        ==> */  O_RELEASE|A_ELECTION_START,
-               /* S_FINALIZE_JOIN      ==> */  O_RELEASE|A_ELECTION_START,
+               /* S_IDLE               ==> */  
A_LOG|A_SHUTDOWN_REQ|A_PE_INVOKE,
+               /* S_ELECTION           ==> */  
A_LOG|A_SHUTDOWN_REQ|A_ELECTION_VOTE,
+               /* S_INTEGRATION        ==> */  A_LOG|A_SHUTDOWN_REQ,
+               /* S_FINALIZE_JOIN      ==> */  A_LOG|A_SHUTDOWN_REQ,
                /* S_NOT_DC             ==> */  A_SHUTDOWN_REQ,
-               /* S_POLICY_ENGINE      ==> */  O_RELEASE|A_ELECTION_START,
-               /* S_RECOVERY           ==> */  A_SHUTDOWN|O_RELEASE,
-               /* S_RELEASE_DC         ==> */  A_SHUTDOWN_REQ,
-               /* S_STARTING           ==> */  A_NOTHING,
+               /* S_POLICY_ENGINE      ==> */  
A_LOG|A_SHUTDOWN_REQ|A_PE_INVOKE,
+               /* S_RECOVERY           ==> */  A_WARN|A_SHUTDOWN|O_RELEASE,
+               /* S_RELEASE_DC         ==> */  A_WARN|A_SHUTDOWN_REQ,
+               /* S_STARTING           ==> */  A_ERROR|A_SHUTDOWN_REQ,
                /* S_PENDING            ==> */  A_SHUTDOWN_REQ,
                /* S_STOPPING           ==> */  A_LOG,
                /* S_TERMINATE          ==> */  A_LOG,
-               /* S_TRANSITION_ENGINE  ==> */  O_RELEASE|A_ELECTION_START,
-               /* S_HALT               ==> */  O_RELEASE|A_SHUTDOWN_REQ|A_WARN,
+               /* S_TRANSITION_ENGINE  ==> */  A_WARN|A_PE_INVOKE,
+               /* S_HALT               ==> */  
A_WARN|A_ELECTION_START|A_SHUTDOWN_REQ,
        },
 
 /* Got an I_STOP */
@@ -1059,7 +1059,7 @@
                /* S_PENDING            ==> */  A_SHUTDOWN,
                /* S_STOPPING           ==> */  A_SHUTDOWN,
                /* S_TERMINATE          ==> */  A_SHUTDOWN,
-               /* S_TRANSITION_ENGINE  ==> */  A_ERROR|A_SHUTDOWN|O_RELEASE,
+               /* S_TRANSITION_ENGINE  ==> */  A_LOG|A_SHUTDOWN|O_RELEASE,
                /* S_HALT               ==> */  A_SHUTDOWN|O_RELEASE|A_WARN,
        },
 
@@ -1228,13 +1228,13 @@
 /* Got an I_PENDING */
        {
                /* S_IDLE               ==> */  O_RELEASE,
-               /* S_ELECTION           ==> */  
O_RELEASE|A_DC_TIMER_STOP|A_DC_TIMER_START,
+               /* S_ELECTION           ==> */  O_RELEASE|A_DC_TIMER_STOP,
                /* S_INTEGRATION        ==> */  O_RELEASE,
                /* S_FINALIZE_JOIN      ==> */  O_RELEASE,
-               /* S_NOT_DC             ==> */  A_LOG|A_DC_TIMER_START,
+               /* S_NOT_DC             ==> */  A_LOG,
                /* S_POLICY_ENGINE      ==> */  O_RELEASE,
                /* S_RECOVERY           ==> */  A_WARN,
-               /* S_RELEASE_DC         ==> */  A_WARN|A_DC_TIMER_START,
+               /* S_RELEASE_DC         ==> */  A_WARN,
                /* S_STARTING           ==> */  
A_LOG|A_DC_TIMER_START|A_CL_JOIN_QUERY,
                /* S_PENDING            ==> */  A_LOG,
                /* S_STOPPING           ==> */  A_WARN,
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/fsa_proto.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- fsa_proto.h 15 Feb 2005 09:45:43 -0000      1.18
+++ fsa_proto.h 10 Jan 2006 13:46:42 -0000      1.19
@@ -1,4 +1,4 @@
-/* $Id: fsa_proto.h,v 1.18 2005/02/15 09:45:43 andrew Exp $ */
+/* $Id: fsa_proto.h,v 1.19 2006/01/10 13:46:42 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -150,6 +150,14 @@
                       enum crmd_fsa_input cur_input,
                       fsa_data_t *msg_data);
 
+/*     A_ELECTION_CHECK        */
+enum crmd_fsa_input
+do_election_check(long long action,
+                 enum crmd_fsa_cause cause,
+                 enum crmd_fsa_state cur_state,
+                 enum crmd_fsa_input cur_input,
+                 fsa_data_t *msg_data);
+
 /*     A_ELECT_TIMER_START, A_ELECTION_TIMEOUT */
 enum crmd_fsa_input
 do_election_timer_ctrl(long long action,
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/join_dc.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- join_dc.c   26 Oct 2005 11:15:47 -0000      1.73
+++ join_dc.c   10 Jan 2006 13:46:42 -0000      1.74
@@ -419,7 +419,13 @@
 #if 0
        ???dig into the fragment and clear shutdown??
        /* the slave will re-ask if it wants to be shutdown */
-       crm_xml_add(lrm_update, XML_CIB_ATTR_CLEAR_SHUTDOWN, XML_BOOLEAN_TRUE);
+
+       crm_data_t *tmp1 = NULL;
+       crm_info("Updating node_status entry");
+       tmp1 = create_node_state(node_uname, NULL, NULL, NULL,
+                                NULL, NULL, TRUE, __FUNCTION__);
+       update_local_cib(create_cib_fragment(tmp1, XML_CIB_TAG_STATUS));
+       free_xml(tmp1);
 #endif
        /* update CIB with the current LRM status from the node
         * We dont need to notify the TE of these updates, a transition will
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/lrm.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -3 -r1.157 -r1.158
--- lrm.c       21 Dec 2005 06:44:11 -0000      1.157
+++ lrm.c       10 Jan 2006 13:46:42 -0000      1.158
@@ -645,9 +645,9 @@
        }
        
        xml_state = create_node_state(
-               fsa_our_uname, fsa_our_uname,
-               ACTIVESTATUS, XML_BOOLEAN_TRUE, ONLINESTATUS,
-               CRMD_JOINSTATE_MEMBER, exp_state, __FUNCTION__);
+               fsa_our_uname, ACTIVESTATUS, XML_BOOLEAN_TRUE,
+               ONLINESTATUS, CRMD_JOINSTATE_MEMBER, exp_state,
+               is_set(fsa_input_register, R_SHUTDOWN), __FUNCTION__);
 
        xml_data  = create_xml_node(xml_state, XML_CIB_TAG_LRM);
        rsc_list  = create_xml_node(xml_data, XML_LRM_TAG_RESOURCES);
@@ -773,15 +773,14 @@
 
        } else if(safe_str_eq(operation, CRM_OP_PROBED)
                  || safe_str_eq(crm_op, CRM_OP_REPROBE)) {
-               const char *our_uuid = get_uuid(fsa_cluster_conn,fsa_our_uname);
-               char *attr_id = crm_concat("lrm-probe", our_uuid, '-');
-               char *attr_set = crm_concat("crmd-transient-", our_uuid, '-');
+               char *attr_id = crm_concat("lrm-probe", fsa_our_uuid, '-');
+               char *attr_set = crm_concat("crmd-transient-", fsa_our_uuid, 
'-');
                const char *probed = XML_BOOLEAN_TRUE;
                if(safe_str_eq(crm_op, CRM_OP_REPROBE)) {
                        probed = XML_BOOLEAN_FALSE;
                }
                
-               update_attr(fsa_cib_conn, cib_none, XML_CIB_TAG_STATUS, 
our_uuid,
+               update_attr(fsa_cib_conn, cib_none, XML_CIB_TAG_STATUS, 
fsa_our_uuid,
                            attr_set, attr_id, CRM_OP_PROBED, probed);
 
                crm_free(attr_id);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/messages.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -3 -r1.138 -r1.139
--- messages.c  12 Oct 2005 18:53:33 -0000      1.138
+++ messages.c  10 Jan 2006 13:46:42 -0000      1.139
@@ -81,7 +81,7 @@
 
 static gboolean last_was_vote = FALSE;
 
-void
+int
 register_fsa_input_adv(
        enum crmd_fsa_cause cause, enum crmd_fsa_input input,
        void *data, long long with_actions,
@@ -107,7 +107,7 @@
                if(data == NULL) {
                        set_bit_inplace(fsa_actions, with_actions);
                        with_actions = A_NOTHING;
-                       return;
+                       return 0;
                }
                crm_err("%s stalled the FSA with data - this may be broken",
                        raised_from);
@@ -120,11 +120,12 @@
        if(input == I_NULL && with_actions == A_NOTHING /* && data == NULL */){
                /* no point doing anything */
                crm_err("Cannot add entry to queue: no input and no action");
-               return;
+               return 0;
                
        } else if(data == NULL) {
                last_was_vote = FALSE;
 
+#if 0
        } else if(last_was_vote && cause == C_HA_MESSAGE && input == I_ROUTER) {
                const char *op = cl_get_string(
                        ((ha_msg_input_t*)data)->msg, F_CRM_TASK);
@@ -143,9 +144,9 @@
                         *    had not disarded the vote).
                         */
                        crm_debug_2("Vote compression: %d", old_len);
-                       return;
+                       return 0;
                }
-
+#endif
        } else if (cause == C_HA_MESSAGE && input == I_ROUTER) {
                const char *op = cl_get_string(
                        ((ha_msg_input_t*)data)->msg, F_CRM_TASK);
@@ -238,6 +239,7 @@
        if(fsa_source) {
                G_main_set_trigger(fsa_source);
        }
+       return last_data_id;
 }
 
 void
@@ -780,7 +782,8 @@
        const char *sys_to    = cl_get_string(stored_msg->msg, F_CRM_SYS_TO);
        const char *host_from = cl_get_string(stored_msg->msg, F_CRM_HOST_FROM);
 
-       crm_debug_2("Received %s in state %s", op, fsa_state2string(fsa_state));
+       crm_debug_2("Received %s "XML_ATTR_REQUEST" from %s in state %s",
+                   op, host_from, fsa_state2string(fsa_state));
        
        if(op == NULL) {
                crm_err("Bad message");
@@ -790,10 +793,14 @@
        } else if(strcmp(op, CRM_OP_NOOP) == 0) {
                crm_debug("no-op from %s", crm_str(host_from));
 
+       } else if(strcmp(op, CRM_OP_NOVOTE) == 0) {
+               register_fsa_input_adv(C_HA_MESSAGE, I_NULL, stored_msg,
+                                      A_ELECTION_COUNT|A_ELECTION_CHECK, 
FALSE, __FUNCTION__);
+
        } else if(strcmp(op, CRM_OP_VOTE) == 0) {
                /* count the vote and decide what to do after that */
                register_fsa_input_adv(C_HA_MESSAGE, I_NULL, stored_msg,
-                                      A_ELECTION_COUNT, FALSE, __FUNCTION__);
+                                      A_ELECTION_COUNT|A_ELECTION_CHECK, 
FALSE, __FUNCTION__);
 
                /* Sometimes we _must_ go into S_ELECTION */
                if(fsa_state == S_HALT) {
@@ -968,9 +975,7 @@
                                next_input = I_TERMINATE;
 
                        } else if(is_set(fsa_input_register, R_SHUTDOWN)) {
-                               crm_err("We asked to be shut down, "
-                                       " are still the DC, yet another node"
-                                       " (DC) is askin us to shutdown!");
+                               crm_info("Shutting ourselves down (DC)");
                                next_input = I_STOP;                    
 
                        } else if(fsa_state != S_STOPPING) {
@@ -999,10 +1004,11 @@
 
        const char *op        = cl_get_string(stored_msg->msg, F_CRM_TASK);
        const char *sys_from  = cl_get_string(stored_msg->msg, F_CRM_SYS_FROM);
+       const char *host_from = cl_get_string(stored_msg->msg, F_CRM_HOST_FROM);
        const char *msg_ref   = cl_get_string(stored_msg->msg, 
XML_ATTR_REFERENCE);
 
-       crm_debug_2("Received %s %s in state %s",
-                   op, XML_ATTR_RESPONSE, fsa_state2string(fsa_state));
+       crm_debug_2("Received %s "XML_ATTR_RESPONSE" from %s in state %s",
+                   op, host_from, fsa_state2string(fsa_state));
        
        if(op == NULL) {
                crm_err("Bad message");
@@ -1028,6 +1034,8 @@
                  || strcmp(op, CRM_OP_HBEAT) == 0
                  || strcmp(op, CRM_OP_SHUTDOWN_REQ) == 0
                  || strcmp(op, CRM_OP_SHUTDOWN) == 0) {
+               crm_debug_2("Ignoring %s from %s in %s",
+                           op, host_from, fsa_state2string(fsa_state));
                next_input = I_NULL;
                
        } else {
@@ -1055,6 +1063,11 @@
        char *now_s = crm_itoa((int)now);
        crm_data_t *node_state = create_xml_node(NULL, XML_CIB_TAG_STATE);
        const char *host_from= cl_get_string(stored_msg, F_CRM_HOST_FROM);
+
+       if(host_from == NULL) {
+               /* we're shutting down and the DC */
+               host_from = fsa_our_uname;
+       }
        
        crm_info("Creating shutdown request for %s",host_from);
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/tengine.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- tengine.c   14 Jun 2005 11:09:03 -0000      1.24
+++ tengine.c   10 Jan 2006 13:46:42 -0000      1.25
@@ -114,10 +114,6 @@
                          fsa_state2string(fsa_state));
                return I_NULL;
                
-       } else if(is_set(fsa_input_register, R_SHUTDOWN)) {
-               crm_err("No point invoking the TE, we're shutting down");
-               return I_NULL;
-
        } else if(is_set(fsa_input_register, R_TE_CONNECTED) == FALSE) {
                if(te_subsystem->pid > 0) {
                        int pid_status = -1;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/crmd/utils.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -3 -r1.81 -r1.82
--- utils.c     22 Nov 2005 02:40:24 -0000      1.81
+++ utils.c     10 Jan 2006 13:46:42 -0000      1.82
@@ -132,6 +132,11 @@
                        get_timer_desc(timer),
                        fsa_input2string(timer->fsa_input));
                
+       } else if(timer == election_timeout) {
+               crm_err("%s (%s) just popped!",
+                       get_timer_desc(timer),
+                       fsa_input2string(timer->fsa_input));
+               
        } else {
                crm_info("%s (%s) just popped!",
                         get_timer_desc(timer),
@@ -581,6 +586,9 @@
                case A_ELECTION_VOTE:
                        actionAsText = "A_ELECTION_VOTE";
                        break;
+               case A_ELECTION_CHECK:
+                       actionAsText = "A_ELECTION_CHECK";
+                       break;
                case A_CL_JOIN_ANNOUNCE:
                        actionAsText = "A_CL_JOIN_ANNOUNCE";
                        break;
@@ -913,6 +921,11 @@
                           "Action %.16llx (A_ELECTION_VOTE) %s",
                          A_ELECTION_VOTE, text);
        }
+       if(is_set(action, A_ELECTION_CHECK)) {
+               do_crm_log(log_level, __FILE__, __FUNCTION__, 
+                          "Action %.16llx (A_ELECTION_CHECK) %s",
+                         A_ELECTION_CHECK, text);
+       }
        if(is_set(action, A_CL_JOIN_ANNOUNCE)) {
                do_crm_log(log_level, __FILE__, __FUNCTION__, 
                           "Action %.16llx (A_CL_JOIN_ANNOUNCE) %s",
@@ -1250,10 +1263,9 @@
 
 crm_data_t*
 create_node_state(
-       const char *uuid, const char *uname,
-       const char *ha_state, const char *ccm_state,
+       const char *uname, const char *ha_state, const char *ccm_state,
        const char *crmd_state, const char *join_state, const char *exp_state,
-       const char *src)
+       gboolean clear_shutdown, const char *src)
 {
        crm_data_t *node_state = create_xml_node(NULL, XML_CIB_TAG_STATE);
 
@@ -1268,6 +1280,14 @@
        crm_xml_add(node_state, XML_CIB_ATTR_EXPSTATE,  exp_state);
        crm_xml_add(node_state, "origin", src);
 
+       if(clear_shutdown) {
+               crm_xml_add(node_state, XML_CIB_ATTR_SHUTDOWN,  "0");
+/*             crm_xml_add(node_state, */
+/*                         XML_CIB_ATTR_REPLACE, XML_TAG_TRANSIENT_NODEATTRS); 
*/
+       }
+       
+               
+       
        crm_log_xml_debug_3(node_state, "created");
 
        return node_state;




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 26, Issue 12
********************************************

Reply via email to