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: lib by davidlee from 
      ([email protected])
   3. Linux-HA CVS: lib by andrew from 
      ([email protected])


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

Message: 1
Date: Thu, 26 Jan 2006 04:36:58 -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/admin


Modified Files:
        crm_attribute.c crm_resource.c crm_verify.c crmadmin.c 


Log Message:
Switch a number of CLI tools to use the new syncronous connections 

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crm_attribute.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- crm_attribute.c     24 Oct 2005 07:54:19 -0000      1.6
+++ crm_attribute.c     26 Jan 2006 11:36:58 -0000      1.7
@@ -1,4 +1,4 @@
-/* $Id: crm_attribute.c,v 1.6 2005/10/24 07:54:19 andrew Exp $ */
+/* $Id: crm_attribute.c,v 1.7 2006/01/26 11:36:58 andrew Exp $ */
 
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -197,7 +197,8 @@
        }
 
        the_cib = cib_new();
-       rc = the_cib->cmds->signon(the_cib, crm_system_name, cib_command);
+       rc = the_cib->cmds->signon(
+               the_cib, crm_system_name, cib_command_synchronous);
 
        if(rc != cib_ok) {
                fprintf(stderr, "Error signing on to the CIB service: %s\n",
@@ -312,6 +313,7 @@
                CRM_DEV_ASSERT(attr_value != NULL);
 
                if(inhibit_pe) {
+                       crm_warn("Inhibiting notifications for this update");
                        cib_opts |= cib_inhibit_notify;
                }
                rc = update_attr(the_cib, cib_opts, type, dest_node, set_name,
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crm_resource.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- crm_resource.c      19 Jan 2006 15:37:50 -0000      1.10
+++ crm_resource.c      26 Jan 2006 11:36:58 -0000      1.11
@@ -1,4 +1,4 @@
-/* $Id: crm_resource.c,v 1.10 2006/01/19 15:37:50 andrew Exp $ */
+/* $Id: crm_resource.c,v 1.11 2006/01/26 11:36:58 andrew Exp $ */
 
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -598,7 +598,7 @@
           || rsc_cmd == 'G' || rsc_cmd == 'g') {
                cib_conn = cib_new();
                rc = cib_conn->cmds->signon(
-                       cib_conn, crm_system_name, cib_command);
+                       cib_conn, crm_system_name, cib_command_synchronous);
                set_working_set_defaults(&data_set);
 
                if(rsc_cmd != 'D' && rsc_cmd != 'U') {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crm_verify.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- crm_verify.c        14 Oct 2005 09:48:26 -0000      1.2
+++ crm_verify.c        26 Jan 2006 11:36:58 -0000      1.3
@@ -1,4 +1,4 @@
-/* $Id: crm_verify.c,v 1.2 2005/10/14 09:48:26 andrew Exp $ */
+/* $Id: crm_verify.c,v 1.3 2006/01/26 11:36:58 andrew Exp $ */
 
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -157,7 +157,8 @@
 
        if(USE_LIVE_CIB) {
                cib_conn = cib_new();
-               rc = cib_conn->cmds->signon(cib_conn, crm_system_name, 
cib_command);
+               rc = cib_conn->cmds->signon(
+                       cib_conn, crm_system_name, cib_command_synchronous);
        }
        
        crm_zero_mem_stats(NULL);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/admin/crmadmin.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- crmadmin.c  19 Dec 2005 16:54:43 -0000      1.61
+++ crmadmin.c  26 Jan 2006 11:36:58 -0000      1.62
@@ -1,4 +1,4 @@
-/* $Id: crmadmin.c,v 1.61 2005/12/19 16:54:43 andrew Exp $ */
+/* $Id: crmadmin.c,v 1.62 2006/01/26 11:36:58 andrew Exp $ */
 
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -368,7 +368,7 @@
                crm_data_t *output = NULL;
                
                enum cib_errors rc = the_cib->cmds->signon(
-                       the_cib, crm_system_name, cib_command);
+                       the_cib, crm_system_name, cib_command_synchronous);
 
                if(rc != cib_ok) {
                        return -1;




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

Message: 2
Date: Thu, 26 Jan 2006 04:52:24 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by davidlee from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : davidlee
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/clplumbing


Modified Files:
        cl_misc.c 


Log Message:
Provide alternatives to /dev/urandom
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_misc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- cl_misc.c   20 Dec 2005 23:32:59 -0000      1.7
+++ cl_misc.c   26 Jan 2006 11:52:21 -0000      1.8
@@ -26,6 +26,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#include <sys/time.h>
+
 int
 cl_str_to_boolean(const char * s, int * ret)
 {
@@ -99,24 +105,93 @@
        return h;
 }
 
-
+/* Used to provide seed to the random number generator */
 int
 cl_random(void)
 {
        char buf[16];
-       
-       FILE* fs = fopen("/dev/urandom", "r");
-       if (fs == NULL){
-               cl_log(LOG_ERR, "%s: Opening file failed", 
+       FILE* fs;
+       struct timeval tv;
+       long horrid;
+
+       /*
+        * Notes, based on reading of man pages of Solaris, FreeBSD and Linux,
+        * and on proof-of-concept tests on Solaris and Linux (32- and 64-bit).
+        *
+        *      Reminder of a subtlety: our intention is not to return a random
+        *      number, but rather to return a random-enough seed for future
+        *      random numbers.  So don't bother trying (e.g.) "rand()" and
+        *      "random()".
+        *
+        * /dev/random and dev/urandom seem to be a related pair.  In the
+        * words of the song: "You can't have one without the other".
+        *
+        * /dev/random is probably the best.  But it can block.  The Solaris
+        * implementation can apparently honour "O_NONBLOCK" and "O_NDELAY".
+        * But can others?  For this reason, I chose not to use it at present.
+        *
+        * /dev/urandom (with the "u") is also good.  This doesn't block.
+        * But some OSes may lack it.  It is tempting to detect its presence
+        * with autoconf and use the result in a "hash-if" here.  BUT... in
+        * at least one OS, its presence can vary depending upon patch levels,
+        * so a binary/package built on an enabled machine might hit trouble
+        * when run on one where it is absent.  (And vice versa: a build on a
+        * disabled machine would be unable to take advantage of it on an
+        * enabled machine.)  Therefore always try for it at run time.
+        *
+        * "gettimeofday()" returns a random-ish number in its millisecond
+        * component.
+        *
+        * -- David Lee, Jan 2006
+        */
+
+       /*
+        * Each block below is logically of the form:
+        *      if good-feature appears present {
+        *              try feature
+        *              if feature worked {
+        *                      return its result
+        *              }
+        *      }
+        *      -- fall through to not-quite-so-good feature --
+        */
+
+       /*
+        * Does "/dev/urandom" work?
+        */
+       fs = fopen("/dev/urandom", "r");
+       if (fs == NULL) {
+               cl_log(LOG_INFO, "%s: Opening file /dev/urandom failed", 
                       __FUNCTION__);
-               return -1;
        }
-       
-       if (fread(buf,1, sizeof(buf), fs)!= sizeof(buf)){
-               cl_log(LOG_ERR, "%s: reading file failed",
+       else {
+               if (fread(buf,1, sizeof(buf), fs)!= sizeof(buf)){
+                       cl_log(LOG_INFO, "%s: reading file /dev/urandom failed",
+                              __FUNCTION__);
+               }
+               else {
+                       return cl_binary_to_int(buf, sizeof(buf));
+               }       
+       }
+
+       /*
+        * Try "gettimeofday()"; use its microsecond output.
+        * (Might it be prudent to let, say, the seconds further adjust this,
+        * in case * the microseconds are too predictable?)
+        */
+       if (gettimeofday(&tv, NULL) != 0) {
+               cl_log(LOG_INFO, "%s: gettimeofday failed", 
                       __FUNCTION__);
-               return -1;
-       }       
-       
-       return cl_binary_to_int(buf, sizeof(buf));
+       }
+       else {
+               return tv.tv_usec;
+       }
+
+       /*
+        * If all else has failed, return (as a number) the address of
+        * something on the stack.
+        * Poor, but at least it has a chance of some sort of variability.
+        */
+       horrid = (long) &tv;
+       return (int) horrid;
 }




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

Message: 3
Date: Thu, 26 Jan 2006 05:05:15 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/lib/crm/common


Modified Files:
        xml.c 


Log Message:


Logging

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/xml.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- xml.c       23 Jan 2006 14:43:07 -0000      1.52
+++ xml.c       26 Jan 2006 12:05:14 -0000      1.53
@@ -1,4 +1,4 @@
-/* $Id: xml.c,v 1.52 2006/01/23 14:43:07 andrew Exp $ */
+/* $Id: xml.c,v 1.53 2006/01/26 12:05:14 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -1765,7 +1765,7 @@
        if(left == NULL) {
                return NULL;
        } else if(right == NULL) {
-               crm_debug_4("Processing <%s id=%s> (complete copy)",
+               crm_debug_5("Processing <%s id=%s> (complete copy)",
                            crm_element_name(left), ID(left));
                return copy_xml(left);
        }
@@ -1786,7 +1786,7 @@
        diff = create_xml_node(NULL, name);
 
        /* changes to name/value pairs */
-       crm_debug_4("Processing <%s id=%s>", crm_str(name), ID(left));
+       crm_debug_5("Processing <%s id=%s>", crm_str(name), ID(left));
 
        xml_prop_iter(left, prop_name, left_value,
                      skip = FALSE;
@@ -1807,17 +1807,17 @@
                      if(right_val == NULL) {
                              differences = TRUE;
                              crm_xml_add(diff, prop_name, left_value);
-                             crm_debug_5("\t%s: %s", crm_str(prop_name),
+                             crm_debug_6("\t%s: %s", crm_str(prop_name),
                                          crm_str(left_value));
                                      
                      } else if(safe_str_eq(left_value, right_val)) {
-                             crm_debug_4("\t%s: %s (removed)",
+                             crm_debug_5("\t%s: %s (removed)",
                                          crm_str(prop_name),
                                          crm_str(left_value));
                      } else {
                              differences = TRUE;
                              crm_xml_add(diff, prop_name, left_value);
-                             crm_debug_4("\t%s: %s->%s",
+                             crm_debug_5("\t%s: %s->%s",
                                          crm_str(prop_name),
                                          crm_str(left_value),
                                          right_val);
@@ -1840,7 +1840,7 @@
        
        if(differences == FALSE) {
                free_xml(diff);
-               crm_debug_4("\tNo changes");
+               crm_debug_5("\tNo changes");
                return NULL;
        }
        crm_xml_add(diff, XML_ATTR_ID, ID(left));




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

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

Reply via email to