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: Tue, 10 Jan 2006 06:49:04 -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/cib


Modified Files:
        primatives.c 


Log Message:
Remove the special handling for node_state objects and
  XML_CIB_ATTR_CLEAR_SHUTDOWN in particular

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/primatives.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- primatives.c        19 Dec 2005 16:54:43 -0000      1.28
+++ primatives.c        10 Jan 2006 13:49:04 -0000      1.29
@@ -1,4 +1,4 @@
-/* $Id: primatives.c,v 1.28 2005/12/19 16:54:43 andrew Exp $ */
+/* $Id: primatives.c,v 1.29 2006/01/10 13:49:04 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -463,12 +463,7 @@
                xml_remove_prop(target, XML_CIB_ATTR_REPLACE);
        }
        
-       if(safe_str_eq(XML_CIB_TAG_STATE, object_name)){
-               update_node_state(target, update);
-               
-       } else {
-               copy_in_properties(target, update);
-       }
+       copy_in_properties(target, update);
 
        CRM_DEV_ASSERT(cl_is_allocated(object_name));
        if(object_id != NULL) {
@@ -503,64 +498,3 @@
        return result;
 }
 
-void
-update_node_state(crm_data_t *target, crm_data_t *update)
-{
-       const char *source      = NULL;
-       gboolean any_updates    = FALSE;
-       gboolean clear_stonith  = FALSE;
-       gboolean clear_shutdown = FALSE;
-
-       xml_prop_iter(
-               update, local_prop_name, local_prop_value,
-               
-               if(local_prop_name == NULL) {
-                       /*  error */
-                       
-               } else if(strcmp(local_prop_name, XML_ATTR_ID) == 0) {
-                       
-               } else if(strcmp(local_prop_name, XML_ATTR_TSTAMP) == 0) {
-
-               } else if(strcmp(local_prop_name, XML_CIB_ATTR_CLEAR_SHUTDOWN) 
== 0) {
-                       clear_shutdown = TRUE;
-                       
-               } else if(strcmp(local_prop_name, XML_CIB_ATTR_CLEAR_STONITH) 
== 0) {
-                       clear_stonith = TRUE;
-                       clear_shutdown = TRUE;                  
-                       
-               } else if(strcmp(local_prop_name, XML_CIB_ATTR_SOURCE) == 0) {
-                       source = local_prop_value;
-                       
-               } else {
-                       any_updates = TRUE;
-                       crm_xml_add(target, local_prop_name, local_prop_value);
-               }
-               );
-       
-       xml_remove_prop(target, XML_CIB_ATTR_CLEAR_SHUTDOWN);
-       if(clear_shutdown) {
-               /*  unset XML_CIB_ATTR_SHUTDOWN  */
-               if(crm_element_value(target, XML_CIB_ATTR_SHUTDOWN) != NULL) {
-                       crm_debug_2("Clearing %s", XML_CIB_ATTR_SHUTDOWN);
-                       xml_remove_prop(target, XML_CIB_ATTR_SHUTDOWN);
-                       any_updates = TRUE;
-               }
-       }
-
-       xml_remove_prop(target, XML_CIB_ATTR_CLEAR_STONITH);
-       if(clear_stonith) {
-               /*  unset XML_CIB_ATTR_STONITH */
-               if(crm_element_value(target, XML_CIB_ATTR_STONITH) != NULL) {
-                       crm_debug_2("Clearing %s", XML_CIB_ATTR_STONITH);
-                       xml_remove_prop(target, XML_CIB_ATTR_STONITH);
-                       any_updates = TRUE;
-               }
-       }
-       
-       if(any_updates) {
-               set_node_tstamp(target);
-               crm_xml_add(target, XML_CIB_ATTR_SOURCE, source);
-       }
-       
-}
-




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

Message: 2
Date: Tue, 10 Jan 2006 06:50:35 -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/cib


Modified Files:
        callbacks.c main.c 


Log Message:
Process all requests made to the CIB up until the point we were asked to exit.
Disconnect anyone that hasn't already.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -3 -r1.86 -r1.87
--- callbacks.c 7 Jan 2006 21:29:51 -0000       1.86
+++ callbacks.c 10 Jan 2006 13:50:34 -0000      1.87
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.86 2006/01/07 21:29:51 andrew Exp $ */
+/* $Id: callbacks.c,v 1.87 2006/01/10 13:50:34 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -48,6 +48,9 @@
 
 #include <crm/dmalloc_wrapper.h>
 
+extern GMainLoop*  mainloop;
+extern gboolean cib_shutdown_flag;
+
 gint cib_GCompareFunc(gconstpointer a, gconstpointer b);
 gboolean cib_msg_timeout(gpointer data);
 void cib_GHFunc(gpointer key, gpointer value, gpointer user_data);
@@ -269,7 +272,7 @@
        }
        
        while(channel->ops->is_message_pending(channel)) {
-               if (channel->ch_status != IPC_CONNECT) {
+               if (channel->ch_status == IPC_DISCONNECT) {
                        /* The message which was pending for us is that
                         * the channel is no longer fully connected.
                         *
@@ -393,9 +396,9 @@
                    cib_client->id, cib_client->channel_name);
 
        while(channel->ops->is_message_pending(channel)) {
-               if (channel->ch_status != IPC_CONNECT) {
+               if (channel->ch_status == IPC_DISCONNECT) {
                        /* The message which was pending for us is that
-                        * the channel is no longer fully connected.
+                        * the channel is no longer connected.
                         *
                         * Dont read requests from disconnected clients
                         */
@@ -964,7 +967,7 @@
                        rc = cib_client_corrupt;
 
                } else if(hash_client->channel->ops->get_chan_status(
-                                 hash_client->channel) != IPC_CONNECT) {
+                                 hash_client->channel) == IPC_DISCONNECT) {
                        crm_warn("Client %s has disconnected", token);
                        rc = cib_client_gone;
                }
@@ -1100,21 +1103,31 @@
 gboolean
 cib_process_disconnect(IPC_Channel *channel, cib_client_t *cib_client)
 {
-       if (channel->ch_status != IPC_CONNECT && cib_client != NULL) {
-               crm_info("Cleaning up after %s channel disconnect from client 
(%p) %s/%s",
+       gboolean keep_connection = TRUE;
+       
+       if (channel == NULL) {
+               keep_connection = FALSE;
+               
+       } else if(channel->ch_status == IPC_DISCONNECT && cib_client != NULL) {
+               crm_debug("Cleaning up after %s channel disconnect from client 
(%p) %s/%s",
                         cib_client->channel_name, cib_client,
                         crm_str(cib_client->id), crm_str(cib_client->name));
 
                if(cib_client->id != NULL) {
                        g_hash_table_remove(client_list, cib_client->id);
+
+               } else {
+                       crm_err("Client with no id");
                }
+               
                if(cib_client->source != NULL) {
                        crm_debug_3("deleting the IPC Channel");
                        G_main_del_IPC_Channel(cib_client->source);
                        cib_client->source = NULL;
                }
                
-               crm_debug_3("Freeing the cib client %s", 
crm_str(cib_client->id));
+               crm_debug_3("Freeing the cib client %s",
+                           crm_str(cib_client->id));
 #if 0
                /* todo - put this back in once i recheck its safe */
                crm_free(cib_client->callback_id);
@@ -1124,14 +1137,27 @@
                crm_free(cib_client);
                crm_debug_3("Freed the cib client");
 
-               return FALSE;
+               keep_connection = FALSE;
 
-       } else if (channel->ch_status != IPC_CONNECT) {
+       } else if (channel->ch_status == IPC_DISCONNECT) {
                crm_warn("Unknown client disconnected");
-               return FALSE;
+               keep_connection = FALSE;
        }
 
-       return TRUE;
+       if(keep_connection == FALSE
+          && cib_shutdown_flag
+          && g_hash_table_size(client_list) == 0) {
+               crm_info("All clients disconnected");
+
+               if (mainloop != NULL && g_main_is_running(mainloop)) {
+                       g_main_quit(mainloop);
+
+               } else {
+                       exit(LSB_EXIT_OK);
+               }
+       }
+       
+       return keep_connection;
 }
 
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- main.c      21 Sep 2005 15:16:50 -0000      1.28
+++ main.c      10 Jan 2006 13:50:34 -0000      1.29
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.28 2005/09/21 15:16:50 andrew Exp $ */
+/* $Id: main.c,v 1.29 2006/01/10 13:50:34 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -51,6 +51,7 @@
 
 #include <crm/dmalloc_wrapper.h>
 
+gboolean cib_shutdown_flag = FALSE;
 
 extern void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int );
 
@@ -308,19 +309,54 @@
 {
 }
 
+
+static void
+disconnect_cib_client(gpointer key, gpointer value, gpointer user_data) 
+{
+       cib_client_t *a_client = value;
+       crm_debug("Processing client %s/%s... send=%d, recv=%d",
+                 a_client->name, a_client->id,
+                 (int)a_client->channel->send_queue->current_qlen,
+                 (int)a_client->channel->recv_queue->current_qlen);
+
+       if(a_client->channel->ch_status == IPC_CONNECT) {
+               a_client->channel->ops->resume_io(a_client->channel);
+               if(a_client->channel->send_queue->current_qlen != 0
+                  || a_client->channel->recv_queue->current_qlen != 0) {
+                       crm_info("Flushed messages to/from %s/%s... send=%d, 
recv=%d",
+                               a_client->name, a_client->id,
+                               
(int)a_client->channel->send_queue->current_qlen,
+                               
(int)a_client->channel->recv_queue->current_qlen);
+               }
+       }
+
+       if(a_client->channel->ch_status == IPC_CONNECT) {
+               crm_warn("Disconnecting %s/%s...", a_client->name,a_client->id);
+               a_client->channel->ops->disconnect(a_client->channel);
+       }
+}
+
+extern gboolean cib_process_disconnect(
+       IPC_Channel *channel, cib_client_t *cib_client);
+
 gboolean
 cib_shutdown(int nsig, gpointer unused)
 {
-       static int shuttingdown = 0;
-  
-       if (!shuttingdown) {
-               shuttingdown = 1;
-       }
-       if (mainloop != NULL && g_main_is_running(mainloop)) {
-               g_main_quit(mainloop);
+       if(cib_shutdown_flag == FALSE) {
+               cib_shutdown_flag = TRUE;
+               crm_debug("Disconnecting %d clients",
+                        g_hash_table_size(client_list));
+               g_hash_table_foreach(client_list, disconnect_cib_client, NULL);
+               crm_info("Disconnected %d clients",
+                        g_hash_table_size(client_list));
+               cib_process_disconnect(NULL, NULL);
+
        } else {
-               exit(LSB_EXIT_OK);
+               crm_info("Waiting for %d clients to disconnect...",
+                        g_hash_table_size(client_list));
        }
+       
+       
        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 26, Issue 13
********************************************

Reply via email to