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: lrm by alan from  ([email protected])
   2. Linux-HA CVS: cts by alan from  ([email protected])
   3. Linux-HA CVS: lrm by alan from  ([email protected])


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

Message: 1
Date: Thu,  9 Feb 2006 21:06:34 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lrm by alan from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : alan
Host    : 
Project : linux-ha
Module  : lrm

Dir     : linux-ha/lrm/lrmd


Modified Files:
        lrmd.c 


Log Message:
Put in a fix suggested by Sun Jiang Dong for an lrm problem where
we try and read from a closed file descriptor.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lrm/lrmd/lrmd.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -3 -r1.211 -r1.212
--- lrmd.c      10 Feb 2006 03:20:01 -0000      1.211
+++ lrmd.c      10 Feb 2006 04:06:34 -0000      1.212
@@ -1,4 +1,4 @@
-/* $Id: lrmd.c,v 1.211 2006/02/10 03:20:01 alan Exp $ */
+/* $Id: lrmd.c,v 1.212 2006/02/10 04:06:34 alan Exp $ */
 /*
  * Local Resource Manager Daemon
  *
@@ -3200,7 +3200,7 @@
        }
 
        op_type = ha_msg_value(op->msg, F_LRM_OP);
-       if (op->first_line_ra_stdout[0] == EOS) {
+       if (op->first_line_ra_stdout[0] == EOS && op->ra_stdout_fd >= 0) {
                handle_pipe_ra_stdout(-1, op);
        }
        rc = RAExec->map_ra_retvalue(exitcode, op_type, 
op->first_line_ra_stdout);
@@ -3376,14 +3376,14 @@
                return FALSE;
        }
 
-       if (fd == -1) {
+       if (fd < 0) {
                fd = op->ra_stdout_fd;
        }
 
        if (fd < 0) {
                lrmd_log(LOG_CRIT
-               ,       "%s:%d: Attempt to read from closed file descriptor."
-               ,       __FUNCTION__, __LINE__);
+               ,       "%s:%d: Attempt to read from closed file descriptor %d."
+               ,       __FUNCTION__, __LINE__, fd);
                lrmd_op_dump(op, "op w/closed fd");
                return FALSE;
        }
@@ -3645,6 +3645,10 @@
 }
 /*
  * $Log: lrmd.c,v $
+ * Revision 1.212  2006/02/10 04:06:34  alan
+ * Put in a fix suggested by Sun Jiang Dong for an lrm problem where
+ * we try and read from a closed file descriptor.
+ *
  * Revision 1.211  2006/02/10 03:20:01  alan
  * Put in checks for unallocated (freed) operation structures.
  * Also print out more information in the cases where I/O fails




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

Message: 2
Date: Thu,  9 Feb 2006 21:07:42 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cts by alan from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : alan
Host    : 
Project : linux-ha
Module  : cts

Dir     : linux-ha/cts


Modified Files:
        CTS.py.in CTStests.py.in 


Log Message:
Separated out the "wait for all nodes to come up" function into
a more usable class...

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CTS.py.in,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- CTS.py.in   13 Sep 2005 16:32:15 -0000      1.48
+++ CTS.py.in   10 Feb 2006 04:07:41 -0000      1.49
@@ -886,32 +886,17 @@
             j=j-1
 
 
-class InitClusterManager(ScenarioComponent):
-    (
-'''InitClusterManager is the most basic of ScenarioComponents.
-This ScenarioComponent simply starts the cluster manager on all the nodes.
-It is fairly robust as it waits for all nodes to come up before starting
-as they might have been rebooted or crashed for some reason beforehand.
-''')
-
-    def IsApplicable(self):
-        '''InitClusterManager is so generic it is always Applicable'''
-        return 1
-
-
-    def _IsNodeBooted(self, node):
+class NodeStatus:
+    def IsNodeBooted(self, node):
         '''Return TRUE if the given node is booted (responds to pings'''
         return os.system("@PING@ -nq -c1 @PING_TIMEOUT_OPT@ %s >/dev/null 
2>&1" % node) == 0
 
-
-    def _WaitForNodeToComeUp(self, node, Timeout=300):
-
-        '''Return TRUE when given node comes up, or FALSE if timeout'''
-
+    def WaitForNodeToComeUp(self, node, Timeout=300):
+        '''Return TRUE when given node comes up, or None/FALSE if timeout'''
         timeout=Timeout
         anytimeouts=0
         while timeout > 0:
-            if self._IsNodeBooted(node):
+            if self.IsNodeBooted(node):
                 if anytimeouts:
                      # Fudge to wait for the system to finish coming up
                      time.sleep(30)
@@ -926,22 +911,35 @@
             timeout = timeout - 1
 
         self.Env.log("%s did not come up within %d tries" % (node, Timeout))
-        return None
 
-    def _WaitForAllNodesToComeUp(self, nodes, timeout=300):
+    def WaitForAllNodesToComeUp(self, nodes, timeout=300):
         '''Return TRUE when all nodes come up, or FALSE if timeout'''
 
         for node in nodes:
-            if not self._WaitForNodeToComeUp(node, timeout):
+            if not self.WaitForNodeToComeUp(node, timeout):
                 return None
         return 1
 
 
 
+class InitClusterManager(ScenarioComponent):
+    (
+'''InitClusterManager is the most basic of ScenarioComponents.
+This ScenarioComponent simply starts the cluster manager on all the nodes.
+It is fairly robust as it waits for all nodes to come up before starting
+as they might have been rebooted or crashed for some reason beforehand.
+''')
+    def __init__(self, Env):
+       self.ns=NodeStatus()
+
+    def IsApplicable(self):
+        '''InitClusterManager is so generic it is always Applicable'''
+        return 1
+
     def SetUp(self, CM):
         '''Basic Cluster Manager startup.  Start everything'''
 
-        if not self._WaitForAllNodesToComeUp(CM.Env["nodes"]):
+        if not self.ns.WaitForAllNodesToComeUp(CM.Env["nodes"]):
             return None
         CM.prepare()
 
@@ -963,7 +961,7 @@
     def TearDown(self, CM):
         '''Set up the given ScenarioComponent'''
 
-        self._WaitForAllNodesToComeUp(CM.Env["nodes"])
+        self.ns.WaitForAllNodesToComeUp(CM.Env["nodes"])
 
         # Stop the cluster manager everywhere
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cts/CTStests.py.in,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -3 -r1.135 -r1.136
--- CTStests.py.in      7 Jan 2006 21:22:20 -0000       1.135
+++ CTStests.py.in      10 Feb 2006 04:07:41 -0000      1.136
@@ -2309,9 +2309,10 @@
             if self.CM.ShouldBeStatus[node] == self.CM["down"]:
                 self.CM.StartaCMnoBlock(node)
         if watch.lookforall():
-            if self.CM.cluster_stable():
-                return self.success()
-            return self.failure("Cluster did not stablize") 
+            for attempt in (1, 2, 3, 4, 5):
+                if self.CM.cluster_stable():
+                    return self.success()
+            return self.failure("Cluster did not stabilize") 
                 
         did_fail=0
         unstable = []




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

Message: 3
Date: Thu,  9 Feb 2006 22:00:36 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lrm by alan from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : alan
Host    : 
Project : linux-ha
Module  : lrm

Dir     : linux-ha/lrm/lrmd


Modified Files:
        lrmd.c 


Log Message:
Fixed two very small lrmd errors.
Improved checking for bad lrmd file descriptors - hopefully catching things 
sooner.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lrm/lrmd/lrmd.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -3 -r1.212 -r1.213
--- lrmd.c      10 Feb 2006 04:06:34 -0000      1.212
+++ lrmd.c      10 Feb 2006 05:00:35 -0000      1.213
@@ -1,4 +1,4 @@
-/* $Id: lrmd.c,v 1.212 2006/02/10 04:06:34 alan Exp $ */
+/* $Id: lrmd.c,v 1.213 2006/02/10 05:00:35 alan Exp $ */
 /*
  * Local Resource Manager Daemon
  *
@@ -1151,7 +1151,7 @@
 
        for (j=0; j < 3; ++j) {
                close(j);
-               (void)open("/dev/null", j == 0 ? O_RDONLY : O_RDONLY);
+               (void)open("/dev/null", j == 0 ? O_RDONLY : O_WRONLY);
        }
        CL_IGNORE_SIG(SIGINT);
        CL_IGNORE_SIG(SIGHUP);
@@ -3094,15 +3094,15 @@
                                        cl_perror("%s::%d: dup2"
                                                , __FUNCTION__, __LINE__);
                                }
+                               close(stdout_fd[1]);
                        }
                        if (STDERR_FILENO != stderr_fd[1]) {
                                if (dup2(stderr_fd[1], 
STDERR_FILENO)!=STDERR_FILENO) {
                                        cl_perror("%s::%d: dup2"
                                                , __FUNCTION__, __LINE__);
                                }
+                               close(stderr_fd[1]);
                        }
-                       close(stdout_fd[1]);
-                       close(stderr_fd[1]);
                        RAExec = g_hash_table_lookup(RAExecFuncs,rsc->class);
                        if (NULL == RAExec) {
                                lrmd_log(LOG_ERR,"perform_ra_op: can not find 
RAExec");
@@ -3380,9 +3380,9 @@
                fd = op->ra_stdout_fd;
        }
 
-       if (fd < 0) {
+       if (fd <= 0) {
                lrmd_log(LOG_CRIT
-               ,       "%s:%d: Attempt to read from closed file descriptor %d."
+               ,       "%s:%d: Attempt to read from closed/invalid file 
descriptor %d."
                ,       __FUNCTION__, __LINE__, fd);
                lrmd_op_dump(op, "op w/closed fd");
                return FALSE;
@@ -3393,7 +3393,7 @@
                        G_main_del_fd(op->ra_stdout_gsource);
                        op->ra_stdout_gsource = NULL;
                }
-               if (op->ra_stdout_fd != -1) {
+               if (op->ra_stdout_fd >= 0) {
                        close(op->ra_stdout_fd);
                        op->ra_stdout_fd = -1;
                }
@@ -3446,6 +3446,14 @@
                return FALSE;
        }
 
+       if (fd <= 0) {
+               lrmd_log(LOG_CRIT
+               ,       "%s:%d: Attempt to read from closed/invalid file 
descriptor %d."
+               ,       __FUNCTION__, __LINE__, fd);
+               lrmd_op_dump(op, "op w/closed fd");
+               return FALSE;
+       }
+
        if (0 != read_pipe(fd, &data, op)) {
                if ( NULL != op->ra_stderr_gsource) {
                        G_main_del_fd(op->ra_stderr_gsource);
@@ -3645,6 +3653,10 @@
 }
 /*
  * $Log: lrmd.c,v $
+ * Revision 1.213  2006/02/10 05:00:35  alan
+ * Fixed two very small lrmd errors.
+ * Improved checking for bad lrmd file descriptors - hopefully catching things 
sooner.
+ *
  * Revision 1.212  2006/02/10 04:06:34  alan
  * Put in a fix suggested by Sun Jiang Dong for an lrm problem where
  * we try and read from a closed file descriptor.




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

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

Reply via email to