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])


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

Message: 1
Date: Mon, 20 Feb 2006 09:21:52 -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/tengine


Modified Files:
        Makefile.am actions.c callbacks.c te_callbacks.h tengine.h 
        utils.c 
Removed Files:
        match.c tengine.c unpack.c 


Log Message:
Remove unused files
Sort out the action timer code now that we have a common TE library
Rename the timer typedef
Quiet some logging now that it works smoothly

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- Makefile.am 14 Feb 2006 15:43:03 -0000      1.23
+++ Makefile.am 20 Feb 2006 16:21:51 -0000      1.24
@@ -51,13 +51,13 @@
 ## SOURCES
 noinst_HEADERS = tengine.h te_callbacks.h
 
-tengine_SOURCES        = actions.c tengine.c events.c utils.c callbacks.c 
main.c
+tengine_SOURCES        = actions.c events.c utils.c callbacks.c main.c
 tengine_CFLAGS = -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
 tengine_LDADD  = $(COMMONLIBS) \
                     $(top_builddir)/lib/fencing/libstonithd.la \
                     $(top_builddir)/lib/crm/transition/libtransitioner.la
 
-ttest_SOURCES  = actions.c tengine.c events.c utils.c callbacks.c ttest.c
+ttest_SOURCES  = actions.c events.c utils.c callbacks.c ttest.c
 ttest_CFLAGS   = -DTESTING=1 -DHA_VARLIBDIR='"@HA_VARLIBDIR@"'
 ttest_LDADD    = $(COMMONLIBS) \
                     $(top_builddir)/lib/fencing/libstonithd.la \
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/actions.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- actions.c   19 Feb 2006 20:05:09 -0000      1.13
+++ actions.c   20 Feb 2006 16:21:51 -0000      1.14
@@ -1,4 +1,4 @@
-/* $Id: actions.c,v 1.13 2006/02/19 20:05:09 andrew Exp $ */
+/* $Id: actions.c,v 1.14 2006/02/20 16:21:51 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -31,10 +31,28 @@
 #include <lrm/lrm_api.h>
 #include <clplumbing/lsb_exitcodes.h>
 
+char *te_uuid = NULL;
+IPC_Channel *crm_ch = NULL;
+
 void send_rsc_command(crm_action_t *action);
 extern void cib_action_updated(const HA_Message *msg, int call_id, int rc,
                               crm_data_t *output, void *user_data);
 
+static void
+te_start_action_timer(crm_action_t *action) 
+{
+       crm_malloc0(action->timer, sizeof(crm_action_timer_t));
+       action->timer->timeout   = action->timeout;
+       action->timer->reason    = timeout_action_warn;
+       action->timer->action    = action;
+       action->timer->source_id = Gmain_timeout_add(
+               action->timer->timeout,
+               action_timer_callback, (void*)action->timer);
+
+       CRM_ASSERT(action->timer->source_id != 0);
+}
+
+
 static gboolean
 te_pseudo_action(crm_graph_t *graph, crm_action_t *pseudo) 
 {
@@ -185,7 +203,7 @@
        } else if(ret && action->timeout > 0) {
                crm_debug("Setting timer for action %d",action->id);
                action->timer->reason = timeout_action_warn;
-               start_te_timer(action->timer);
+               te_start_action_timer(action);
        }
        
        return TRUE;
@@ -385,7 +403,7 @@
                                  transition_graph->transition_timeout);
                        transition_graph->transition_timeout = action_timeout;
                }
-               start_te_timer(action->timer);
+               te_start_action_timer(action);
        }
 }
 
@@ -396,6 +414,37 @@
        te_fence_node
 };
 
+static int
+unconfirmed_actions(gboolean send_updates)
+{
+       int unconfirmed = 0;
+       crm_debug_2("Unconfirmed actions...");
+       slist_iter(
+               synapse, synapse_t, transition_graph->synapses, lpc,
+
+               /* lookup event */
+               slist_iter(
+                       action, crm_action_t, synapse->actions, lpc2,
+                       if(action->executed == FALSE) {
+                               continue;
+                               
+                       } else if(action->confirmed) {
+                               continue;
+                       }
+                       
+                       unconfirmed++;
+                       crm_debug("Action %d: unconfirmed",action->id);
+                       if(send_updates) {
+                               cib_action_update(action, LRM_OP_TIMEOUT);
+                       }
+                       );
+               );
+       if(unconfirmed > 0) {
+               crm_info("Waiting on %d unconfirmed actions", unconfirmed);
+       }
+       return unconfirmed;
+}
+
 void
 notify_crmd(crm_graph_t *graph)
 {      
@@ -404,7 +453,7 @@
        enum transition_action completion_action = tg_restart;
        int id = -1;
        
-       int unconfirmed = unconfirmed_actions();
+       int unconfirmed = unconfirmed_actions(FALSE);
        int pending_callbacks = num_cib_op_callbacks();
        HA_Message *cmd = NULL;
        const char *op = CRM_OP_TEABORT;
@@ -412,6 +461,8 @@
        if(unconfirmed != 0) {
                crm_err("Write %d unconfirmed actions to the CIB", unconfirmed);
                /* TODO: actually write them */
+               unconfirmed_actions(TRUE);
+
 /*             return; */
        }
        
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/callbacks.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- callbacks.c 19 Feb 2006 09:08:32 -0000      1.68
+++ callbacks.c 20 Feb 2006 16:21:51 -0000      1.69
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.68 2006/02/19 09:08:32 andrew Exp $ */
+/* $Id: callbacks.c,v 1.69 2006/02/20 16:21:51 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -359,25 +359,60 @@
 
 
 gboolean
-timer_callback(gpointer data)
+action_timer_callback(gpointer data)
 {
-       te_timer_t *timer = NULL;
+       crm_action_timer_t *timer = NULL;
        
        if(data == NULL) {
                crm_err("Timer popped with no data");
                return FALSE;
        }
        
-       timer = (te_timer_t*)data;
+       timer = (crm_action_timer_t*)data;
        stop_te_timer(timer);
 
        crm_warn("Timer popped (abort_level=%d, complete=%s)",
                 transition_graph->abort_priority,
                 transition_graph->complete?"true":"false");
 
+       CRM_DEV_ASSERT(timer->action != NULL);
+
+       if(transition_graph->complete) {
+               crm_err("Ignoring timeout while not in transition");
+               
+       } else if(timer->reason == timeout_action_warn) {
+               print_graph_action(
+                       LOG_WARNING,"Action missed its timeout", timer->action);
+               
+       } else {
+               /* fail the action */
+               cib_action_update(timer->action, LRM_OP_TIMEOUT);
+       }
+
+       return FALSE;
+}
+
+gboolean
+global_timer_callback(gpointer data)
+{
+       crm_action_timer_t *timer = NULL;
+       
+       if(data == NULL) {
+               crm_err("Timer popped with no data");
+               return FALSE;
+       }
+       
+       timer = (crm_action_timer_t*)data;
+       stop_te_timer(timer);
+
+       crm_warn("Timer popped (abort_level=%d, complete=%s)",
+                transition_graph->abort_priority,
+                transition_graph->complete?"true":"false");
+
+       CRM_DEV_ASSERT(timer->action == NULL);
+       
        if(transition_graph->complete) {
                crm_err("Ignoring timeout while not in transition");
-               return TRUE;
                
        } else if(timer->reason == timeout_abort) {
                crm_err("Transition abort timeout reached..."
@@ -386,29 +421,11 @@
 
                transition_graph->complete = TRUE;
                abort_transition(INFINITY, -1, "Global Timeout", NULL);
-               return TRUE;
-               
-       } else if(timer->action == NULL) {
-               crm_err("Action not present!");
-               return FALSE;
-               
-       } else if(timer->reason == timeout_action_warn) {
-               print_graph_action(LOG_WARNING, "Action missed its timeout",
-                            timer->action);
-               return TRUE;
-               
-       } else {
-               /* fail the action
-                * - which may or may not abort the transition
-                */
-
-               /* TODO: send a cancel notice to the LRM */
-               /* TODO: use the ack from above to update the CIB */
-               return cib_action_update(timer->action, LRM_OP_TIMEOUT);
        }
+       return FALSE;           
 }
 
-te_timer_t *transition_timer = NULL;
+crm_action_timer_t *transition_timer = NULL;
 
 gboolean
 te_graph_trigger(gpointer user_data) 
@@ -422,7 +439,7 @@
        }
 
        if(transition_timer == NULL) {
-               crm_malloc0(transition_timer, sizeof(te_timer_t));
+               crm_malloc0(transition_timer, sizeof(crm_action_timer_t));
                transition_timer->source_id = 0;
                transition_timer->reason    = timeout_abort;
                transition_timer->action    = NULL;
@@ -434,8 +451,6 @@
        transition_timer->timeout = transition_graph->transition_timeout;
        if(graph_rc == transition_active) {
                crm_debug_3("Transition not yet complete");
-
-               /* restart the transition timer again */
                stop_te_timer(transition_timer);
                start_te_timer(transition_timer);
                return TRUE;            
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/te_callbacks.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- te_callbacks.h      14 Feb 2006 11:43:00 -0000      1.1
+++ te_callbacks.h      20 Feb 2006 16:21:51 -0000      1.2
@@ -1,4 +1,4 @@
-/* $Id: te_callbacks.h,v 1.1 2006/02/14 11:43:00 andrew Exp $ */
+/* $Id: te_callbacks.h,v 1.2 2006/02/20 16:21:51 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -25,7 +25,8 @@
 extern void cib_action_updated(const HA_Message *msg, int call_id, int rc,
                               crm_data_t *output, void *user_data);
 
-extern gboolean timer_callback(gpointer data);
+extern gboolean global_timer_callback(gpointer data);
+extern gboolean action_timer_callback(gpointer data);
 
 extern gboolean te_graph_trigger(gpointer user_data);
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/tengine.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- tengine.h   19 Feb 2006 09:08:32 -0000      1.34
+++ tengine.h   20 Feb 2006 16:21:51 -0000      1.35
@@ -1,4 +1,4 @@
-/* $Id: tengine.h,v 1.34 2006/02/19 09:08:32 andrew Exp $ */
+/* $Id: tengine.h,v 1.35 2006/02/20 16:21:51 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -34,8 +34,8 @@
 extern gboolean cib_action_update(crm_action_t *action, int status);
 
 /* utils */
-extern gboolean stop_te_timer(te_timer_t *timer);
-extern gboolean start_te_timer(te_timer_t *timer);
+extern gboolean stop_te_timer(crm_action_timer_t *timer);
+extern gboolean start_te_timer(crm_action_timer_t *timer);
 extern const char *get_rsc_state(const char *task, op_status_t status);
 
 /* unpack */
@@ -49,7 +49,6 @@
 extern char *te_uuid;
 extern cib_t *te_cib_conn;
 
-extern int unconfirmed_actions(void);
 extern void notify_crmd(crm_graph_t *graph);
 
 #include <te_callbacks.h>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/utils.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- utils.c     19 Feb 2006 09:08:32 -0000      1.55
+++ utils.c     20 Feb 2006 16:21:51 -0000      1.56
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.55 2006/02/19 09:08:32 andrew Exp $ */
+/* $Id: utils.c,v 1.56 2006/02/20 16:21:51 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -32,8 +32,6 @@
 
 extern cib_t *te_cib_conn;
 
-gboolean timer_callback(gpointer data);
-void set_timer_value(te_timer_t *timer, const char *time, int time_default);
 
 const char *
 get_rsc_state(const char *task, op_status_t status) 
@@ -82,31 +80,15 @@
        }
 }
 
-void
-set_timer_value(te_timer_t *timer, const char *time, int time_default)
-{
-       int tmp_time;
-
-       if(timer == NULL) {
-               return;
-       }
-       
-       timer->timeout = time_default;
-       tmp_time = crm_get_msec(time);
-       if(tmp_time > 0) {
-               timer->timeout = tmp_time;
-       }
-}
-
 gboolean
-start_te_timer(te_timer_t *timer)
+start_te_timer(crm_action_timer_t *timer)
 {
        if(timer == NULL) {
                return FALSE;
 
        } else if(timer->source_id != 0) {
                timer->source_id = Gmain_timeout_add(
-                       timer->timeout, timer_callback, (void*)timer);
+                       timer->timeout, global_timer_callback, (void*)timer);
                CRM_ASSERT(timer->source_id != 0);
                return TRUE;
 
@@ -122,7 +104,7 @@
 
 
 gboolean
-stop_te_timer(te_timer_t *timer)
+stop_te_timer(crm_action_timer_t *timer)
 {
        if(timer == NULL) {
                return FALSE;




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

_______________________________________________
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 86
********************************************

Reply via email to