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


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

Message: 1
Date: Thu,  9 Mar 2006 03:07:53 -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/pengine


Modified Files:
        graph.c 


Log Message:
Some notes to myself

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/graph.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- graph.c     16 Feb 2006 22:18:55 -0000      1.75
+++ graph.c     9 Mar 2006 10:07:53 -0000       1.76
@@ -1,4 +1,4 @@
-/* $Id: graph.c,v 1.75 2006/02/16 22:18:55 andrew Exp $ */
+/* $Id: graph.c,v 1.76 2006/03/09 10:07:53 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -470,7 +470,7 @@
        if(action->pseudo
           || safe_str_eq(action->task,  CRM_OP_FENCE)
           || safe_str_eq(action->task,  CRM_OP_SHUTDOWN)) {
-               /* skip the next two checks */
+               /* skip the next checks */
                return TRUE;
        }
 
@@ -485,6 +485,16 @@
                       action->id, action->uuid);
                log_action(LOG_DEBUG, "Action for offline node", action, FALSE);
                return FALSE;
+#if 0
+               /* but this would also affect resources that can be safely
+                *  migrated before a fencing op
+                */
+       } else if(action->node->details->unclean == FALSE) {
+               pe_err("action %d was (%s) scheduled for unclean node",
+                      action->id, action->uuid);
+               log_action(LOG_DEBUG, "Action for unclean node", action, FALSE);
+               return FALSE;
+#endif
        }
        return TRUE;
 }




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

Message: 2
Date: Thu,  9 Mar 2006 04:29:11 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: resources by xunsun from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : xunsun
Host    : 
Project : linux-ha
Module  : resources

Dir     : linux-ha/resources/OCF


Modified Files:
        IPaddr.in 


Log Message:
put in code to respect the broadcast parameter
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPaddr.in,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- IPaddr.in   20 Dec 2005 08:34:47 -0000      1.35
+++ IPaddr.in   9 Mar 2006 11:29:10 -0000       1.36
@@ -227,7 +227,7 @@
            OCF_RESKEY_netmask=`echo "$NICINFO" | cut -f2 | cut -d ' ' -f2`
            OCF_RESKEY_broadcast=`echo "$NICINFO" | cut -f3 | cut -d ' ' -f2`
        else
-           ocf_log err "Failed: $FINDIF 
$OCF_RESKEY_ip/$OCF_RESKEY_netmask/$OCF_RESKEY_nic/$OCF_RESKEY_broadcast . 
Parameter error."
+           ocf_log err "Failed: $IFCMD . Parameter error."
            exit $OCF_ERR_GENERIC
        fi
 
@@ -499,13 +499,15 @@
   iface="$2"
   netmask_bits="$3"
   netmask_text=""
+  broadcast="$4"
 
-  IFCMD="$FINDIF $ipaddr/$netmask_bits/$iface"
+  IFCMD="$FINDIF $ipaddr/$netmask_bits/$iface/$broadcast"
   NICINFO=`$IFCMD`
   
   rc=$?
   if [ $? -eq 0 ]; then
       netmask_text=`echo "$NICINFO" | cut -f2`
+      broadcast=`echo "$NICINFO" | cut -f3`
   else
       echo "ERROR: $IFCMD failed (rc=$rc)"
   fi
@@ -528,7 +530,7 @@
          CMD="$IFCONFIG $iface inet $ipaddr netmask 255.255.255.255 alias"
          ;;
     *)         
-         CMD="$IFCONFIG $iface $ipaddr $netmask_text"
+         CMD="$IFCONFIG $iface $ipaddr $netmask_text $broadcast"
          ;;
   esac
 
@@ -703,7 +705,7 @@
        fi
     fi
     
-    add_interface "$OCF_RESKEY_ip" "$NIC_unique" "$OCF_RESKEY_netmask"
+    add_interface "$OCF_RESKEY_ip" "$NIC_unique" "$OCF_RESKEY_netmask" 
"$OCF_RESKEY_broadcast"
     rc=$?
     if [ $rc != 0 ]; then
        return $rc




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

Message: 3
Date: Thu,  9 Mar 2006 05:55:11 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: resources by xunsun from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : xunsun
Host    : 
Project : linux-ha
Module  : resources

Dir     : linux-ha/resources/OCF


Modified Files:
        AudibleAlarm.in ClusterMon.in Delay.in Dummy.in Filesystem.in 
        ICP.in IPaddr.in IPaddr2.in IPsrcaddr.in IPv6addr.c LVM.in 
        LinuxSCSI.in MailTo.in Raid1.in ServeRAID.in WAS.in 
        WinPopup.in Xinetd.in apache.in db2.in drbd.in 
        ocf-shellfuncs.in portblock.in 


Log Message:
*moved run() function to ocf-shellfuncs
*added logic to support RA states OCF_RUNNING_MASTER and OCF_FAILED_MASTER
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ClusterMon.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ClusterMon.in       2 Feb 2006 14:21:08 -0000       1.8
+++ ClusterMon.in       9 Mar 2006 12:55:10 -0000       1.9
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: ClusterMon.in,v 1.8 2006/02/02 14:21:08 andrew Exp $
+#      $Id: ClusterMon.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
 #
 #      ClusterMon OCF RA. Does nothing but wait a few seconds, can be
 #      configured to fail occassionally.
@@ -159,27 +159,12 @@
     if [ ! -z $pid ]; then
        kill -0 $pid
        if [ $? = 0 ]; then
-           exit $OCF_SUCCESS
+           return `return_master $OCF_SUCCESS`
        fi
     fi
     exit $OCF_NOT_RUNNING
 }
 
-CheckInterval() {
-# We know $1 is non-empty beforehand
-
-# This test is basically same as 
-#
-# if [ "$1" -gt 0 ]
-#
-# However this is safer if user accidently set OCF_RESKEY_update="1 2"...
-    case $1 in
-       *[^0-9]*) false;; #got invalid char
-       *[1-9]*) true;; #no invalid char, at most one decimal point, contains 
non-zero digit <=> valid
-       *) false;; #"0" string
-    esac
-}
-
 CheckOptions() {
 while getopts Vi:nrh:cdp: OPTION
 do
@@ -224,7 +209,7 @@
     esac
 
 # Check the update interval
-    if CheckInterval "$OCF_RESKEY_update"; then
+    if ocf_is_decimal "$OCF_RESKEY_update" && [ $OCF_RESKEY_update -gt 0 ]; 
then
        :
     else
        ocf_log err "Invalid update interval $OCF_RESKEY_update. It should be 
positive integer!"
@@ -278,4 +263,4 @@
                ;;
 esac
 
-exit $OCF_SUCCESS
+exit $?
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Delay.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- Delay.in    11 Feb 2006 14:21:20 -0000      1.9
+++ Delay.in    9 Mar 2006 12:55:10 -0000       1.10
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: Delay.in,v 1.9 2006/02/11 14:21:20 xunsun Exp $
+#      $Id: Delay.in,v 1.10 2006/03/09 12:55:10 xunsun Exp $
 #
 # Support:      [EMAIL PROTECTED]
 # License:      GNU General Public License (GPL)
@@ -36,7 +36,7 @@
 usage() {
   cat <<-!
        usage: $0 {start|stop|status|monitor|meta-data|validate-all}
-       $Id: Delay.in,v 1.9 2006/02/11 14:21:20 xunsun Exp $
+       $Id: Delay.in,v 1.10 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -102,7 +102,7 @@
     Delay_stat
   then
     ocf_log info "Delay is running OK"
-    return $OCF_SUCCESS
+    return_master $OCF_SUCCESS
   else
     ocf_log info "Delay is stopped"
     return $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Dummy.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Dummy.in    3 Jun 2005 03:27:31 -0000       1.2
+++ Dummy.in    9 Mar 2006 12:55:10 -0000       1.3
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: Dummy.in,v 1.2 2005/06/03 03:27:31 sunjd Exp $
+#      $Id: Dummy.in,v 1.3 2006/03/09 12:55:10 xunsun Exp $
 #
 #      Dummy OCF RA. Does nothing but wait a few seconds, can be
 #      configured to fail occassionally.
@@ -114,6 +114,7 @@
 
 dummy_monitor() {
        sleep $OCF_RESKEY_monitor_delay
+       return_monitor $?
 }
 
 dummy_validate() {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Filesystem.in,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- Filesystem.in       11 Feb 2006 13:40:42 -0000      1.15
+++ Filesystem.in       9 Mar 2006 12:55:10 -0000       1.16
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Filesystem.in,v 1.15 2006/02/11 13:40:42 xunsun Exp $
+# $Id: Filesystem.in,v 1.16 2006/03/09 12:55:10 xunsun Exp $
 #
 # Support:      [EMAIL PROTECTED]
 # License:      GNU General Public License (GPL)
@@ -95,7 +95,7 @@
 usage() {
        cat <<-EOT
        usage: $0 {start|stop|status|monitor|validate-all|meta-data}
-       $Id: Filesystem.in,v 1.15 2006/02/11 13:40:42 xunsun Exp $
+       $Id: Filesystem.in,v 1.16 2006/03/09 12:55:10 xunsun Exp $
        EOT
 }
 
@@ -348,7 +348,7 @@
         case "$OP" in
          status)       ocf_log info "$msg";;
        esac
-        return $rc
+        return_master $rc
 }
 # end of Filesystem_status
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ICP.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ICP.in      26 Jan 2006 18:00:05 -0000      1.5
+++ ICP.in      9 Mar 2006 12:55:10 -0000       1.6
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: ICP.in,v 1.5 2006/01/26 18:00:05 lars Exp $
+# $Id: ICP.in,v 1.6 2006/03/09 12:55:10 xunsun Exp $
 # 
 # ICP
 #
@@ -53,7 +53,7 @@
        The 'validate-all' operation reports whether OCF instance parameters 
are valid.
        The 'methods' operation reports on the methods $0 supports
 
-       $Id: ICP.in,v 1.5 2006/01/26 18:00:05 lars Exp $
+       $Id: ICP.in,v 1.6 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -101,36 +101,6 @@
 }
 
 #
-#      run:  run a script, and log its output.
-#
-run() {
-  output=`"$@" 2>&1`
-  rc=$?
-  output=`echo $output`
-  if
-    [ $rc -eq 0 ]
-  then 
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log "info" "$output"
-    fi
-    return 0
-  else
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log "err" "$output"
-    else
-      ocf_log "err" "command failed: $*"
-    fi
-    return $rc
-  fi
-}
-
-
-
-#
 # methods: What methods/operations do we support?
 #
 ICP_methods() {
@@ -190,7 +160,7 @@
   if
     ICP_status $1
   then
-    : OK
+    return_master $?
   else
     ocf_log "err" "ICP host drive $1 is offline"
     return $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPaddr.in,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- IPaddr.in   9 Mar 2006 11:29:10 -0000       1.36
+++ IPaddr.in   9 Mar 2006 12:55:10 -0000       1.37
@@ -732,7 +732,7 @@
     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
     do
        ip_monitor
-       if [ $? = $OCF_SUCCESS ]; then
+       if [ $? = $OCF_SUCCESS -o $? = $OCF_RUNNING_MASTER ]; then
            return $OCF_SUCCESS
        fi
        sleep 1
@@ -796,11 +796,11 @@
 
   for j in 1 2 3; do
     if @PING@ $PINGARGS >/dev/null 2>&1 ; then
-       return $OCF_SUCCESS
+       return `return_master $OCF_SUCCESS`
     fi
   done
 
-  return $OCF_ERR_GENERIC
+  return `return_master $OCF_ERR_GENERIC`
 }
 
 is_positive_integer() {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPaddr2.in,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- IPaddr2.in  20 Dec 2005 08:34:47 -0000      1.15
+++ IPaddr2.in  9 Mar 2006 12:55:10 -0000       1.16
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: IPaddr2.in,v 1.15 2005/12/20 08:34:47 zhenh Exp $
+#      $Id: IPaddr2.in,v 1.16 2006/03/09 12:55:10 xunsun Exp $
 #
 #       OCF Resource Agent compliant IPaddr2 script.
 #
@@ -648,14 +648,14 @@
        # interface health maybe via a daemon like FailSafe etc...
        case `ip_served $BASEIP` in
        ok)
-               exit $OCF_SUCCESS
+               return_master $OCF_SUCCESS
                ;;
        partial|no)
                exit $OCF_NOT_RUNNING
                ;;
        *)
                # Errors on this interface?
-               exit $OCF_ERR_GENERIC
+               return_master $OCF_ERR_GENERIC
                ;;
        esac
 }
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPsrcaddr.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- IPsrcaddr.in        20 Dec 2005 08:34:47 -0000      1.4
+++ IPsrcaddr.in        9 Mar 2006 12:55:10 -0000       1.5
@@ -194,13 +194,13 @@
 
        case $? in
                0)      echo "OK"
-                       return $OCF_SUCCESS;;
+                       return_master $OCF_SUCCESS;;
 
                1)      echo "No preferred source address defined"
                        return $OCF_NOT_RUNNING;;
 
                2)      echo "Preferred source address has incorrect value"
-                       return $OCF_ERR_GENERIC;;
+                       return_master $OCF_ERR_GENERIC;;
        esac
 }
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/IPv6addr.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- IPv6addr.c  20 Dec 2005 08:34:47 -0000      1.9
+++ IPv6addr.c  9 Mar 2006 12:55:10 -0000       1.10
@@ -81,10 +81,15 @@
  *     return 0(OCF_SUCCESS) for response correctly.
  *     return 1(OCF_NOT_RUNNING) for no response.
  *     return 2(OCF_ERR_ARGS) for invalid or excess argument(s)
- *
+ *     return 8(OCF_RUNNING_MASTER) for running in "master" mode
  */
 
+#include <portability.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
+#include <stdlib.h>
 #include <sys/types.h>
 #include <netinet/icmp6.h>
 #include <libgen.h>
@@ -109,6 +114,8 @@
 5      program is not installed
 6      program is not configured
 7      program is not running
+8      resource is running in "master" mode and fully operational
+9      resource is in "master" mode but in a failed state
 */
 #define        OCF_SUCCESS             0
 #define        OCF_ERR_GENERIC         1
@@ -118,6 +125,8 @@
 #define        OCF_ERR_INSTALLED       5
 #define        OCF_ERR_CONFIGURED      6
 #define        OCF_NOT_RUNNING         7
+#define OCF_RUNNING_MASTER     8
+#define OCF_FAILED_MASTER      9
 
 const char* IF_INET6           = "/proc/net/if_inet6";
 const char* APP_NAME           = "IPv6addr";
@@ -363,11 +372,14 @@
 int
 monitor_addr6(struct in6_addr* addr6, int prefix_len)
 {
+       char*   interval;       
        if(0 == is_addr6_available(addr6)) {
+               interval = getenv("OCF_RESKEY_interval");
+               if (interval && atoi(interval) == 0)
+                       return OCF_RUNNING_MASTER;
                return OCF_SUCCESS;
        }
        return OCF_NOT_RUNNING;
-
 }
 
 /* Send an unsolicited advertisement packet
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/LVM.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- LVM.in      26 Jan 2006 18:00:05 -0000      1.10
+++ LVM.in      9 Mar 2006 12:55:10 -0000       1.11
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: LVM.in,v 1.10 2006/01/26 18:00:05 lars Exp $
+# $Id: LVM.in,v 1.11 2006/03/09 12:55:10 xunsun Exp $
 # 
 # LVM
 #
@@ -48,7 +48,7 @@
        The 'validate-all' operation checks whether the OCF parameters are valid
        The 'methods' operation reports on the methods $0 supports
 
-       $Id: LVM.in,v 1.10 2006/01/26 18:00:05 lars Exp $
+       $Id: LVM.in,v 1.11 2006/03/09 12:55:10 xunsun Exp $
        !
   exit $OCF_ERR_GENERIC 
 
@@ -91,36 +91,6 @@
 }
 
 #
-#      run:  run a script, and log its output.
-#
-run() {
-  output=`"$@" 2>&1`
-  rc=$?
-  output=`echo $output`
-  if
-    [ $rc -eq 0 ]
-  then 
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log info "$output"
-    fi
-    return $OCF_SUCCESS 
-  else
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log err "$output"
-    else
-      ocf_log err "command failed: $*"
-    fi
-    return $rc
-  fi
-}
-
-
-
-#
 # methods: What methods/operations do we support?
 #
 LVM_methods() {
@@ -206,7 +176,7 @@
 
   run vgck $1
 
-  return $?
+  return_master $?
 }
 
 #
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/LinuxSCSI.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- LinuxSCSI.in        26 Jan 2006 18:00:05 -0000      1.7
+++ LinuxSCSI.in        9 Mar 2006 12:55:10 -0000       1.8
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: LinuxSCSI.in,v 1.7 2006/01/26 18:00:05 lars Exp $
+# $Id: LinuxSCSI.in,v 1.8 2006/03/09 12:55:10 xunsun Exp $
 # 
 # LinuxSCSI
 #
@@ -98,7 +98,7 @@
        keep in the volumes.  If you don't use a reasonable volume manager,
        then you'll have to mount by UUID.
 
-       $Id: LinuxSCSI.in,v 1.7 2006/01/26 18:00:05 lars Exp $
+       $Id: LinuxSCSI.in,v 1.8 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -282,7 +282,7 @@
                          scsi_status $instance
                        then
                          ocf_log info "SCSI device $instance is running"
-                         exit $OCF_SUCCESS
+                         return_master $OCF_SUCCESS
                        else
                          ocf_log info "SCSI device $instance is stopped"
                          exit $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/MailTo.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- MailTo.in   17 Feb 2006 13:33:08 -0000      1.6
+++ MailTo.in   9 Mar 2006 12:55:10 -0000       1.7
@@ -39,7 +39,7 @@
 
 usage() {
   echo "Usage: $0 {start|stop|status|monitor|meta-data|validate-all}"
-  echo "$Id: MailTo.in,v 1.6 2006/02/17 13:33:08 xunsun Exp $"
+  echo "$Id: MailTo.in,v 1.7 2006/03/09 12:55:10 xunsun Exp $"
 }
 
 meta_data() {
@@ -125,7 +125,7 @@
 
        if [ -f $MAILTOFILE ]; then
                echo "running"
-               return $OCF_SUCCESS
+               return_master $OCF_SUCCESS
        else
                echo "stopped"
                return $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Raid1.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Raid1.in    16 Feb 2006 08:36:31 -0000      1.8
+++ Raid1.in    9 Mar 2006 12:55:10 -0000       1.9
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: Raid1.in,v 1.8 2006/02/16 08:36:31 xunsun Exp $
+# $Id: Raid1.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
 #
 # License:      GNU General Public License (GPL)
 # Support:      [EMAIL PROTECTED]
@@ -123,7 +123,7 @@
 usage() {
        cat <<-EOT
        usage: $0 {start|stop|status|monitor|validate-all|usage|meta-data}
-       $Id: Raid1.in,v 1.8 2006/02/16 08:36:31 xunsun Exp $
+       $Id: Raid1.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
        EOT
 }
 
@@ -278,7 +278,7 @@
            return $OCF_NOT_RUNNING
        else
            echo "running"
-           return $OCF_SUCCESS
+           return_master $OCF_SUCCESS
        fi
 
 }    
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ServeRAID.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ServeRAID.in        26 Jan 2006 18:00:05 -0000      1.8
+++ ServeRAID.in        9 Mar 2006 12:55:10 -0000       1.9
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: ServeRAID.in,v 1.8 2006/01/26 18:00:05 lars Exp $
+# $Id: ServeRAID.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
 # 
 # ServeRAID
 #
@@ -104,7 +104,7 @@
        You will need at least version 6.10 (~July 2003 release) of the ipssend
        command for this script to work.
 
-       $Id: ServeRAID.in,v 1.8 2006/01/26 18:00:05 lars Exp $
+       $Id: ServeRAID.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -210,30 +210,30 @@
 #      codes reversed - it returns 1 for success, and 0 for failure...
 #      We account for that too...
 #
-run() {
-  output=`"$@" 2>&1`
-  rc=$?
-  output=`echo $output`
-  if
-    [ $rc -eq $srsuccess ]
-  then 
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log "info" "$output"
-    fi
-    return 0
-  else
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log "err" "$output"
-    else
-      ocf_log "err"  "command failed: $*"
-    fi
-    return 1
-  fi
-}
+#run() {
+#  output=`"$@" 2>&1`
+#  rc=$?
+#  output=`echo $output`
+#  if
+#    [ $rc -eq $srsuccess ]
+#  then 
+#    if
+#      [ ! -z "$output" ]
+#    then
+#      ocf_log "info" "$output"
+#    fi
+#    return 0
+#  else
+#    if
+#      [ ! -z "$output" ]
+#    then
+#      ocf_log "err" "$output"
+#    else
+#      ocf_log "err"  "command failed: $*"
+#    fi
+#    return 1
+#  fi
+#}
 
 SRLogicalDriveConfig() {
   $IPS getconfig $sr_adapter ld
@@ -435,7 +435,7 @@
          ServeRAID_status $serveraid $mergegroup
        then
          ocf_log debug "ServeRAID merge group $serveraid $mergegroup is 
running."
-         exit $OCF_SUCCESS
+         return_master $OCF_SUCCESS
        else
          ocf_log debug "ServeRAID merge group $serveraid $mergegroup is 
stopped."
          exit $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/WAS.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- WAS.in      11 Feb 2006 14:31:14 -0000      1.9
+++ WAS.in      9 Mar 2006 12:55:10 -0000       1.10
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: WAS.in,v 1.9 2006/02/11 14:31:14 xunsun Exp $
+# $Id: WAS.in,v 1.10 2006/03/09 12:55:10 xunsun Exp $
 # 
 # WAS
 #
@@ -99,7 +99,7 @@
        We run servlet/snoop on the first transport port listed in
        the config file for the "monitor" operation.
 
-       $Id: WAS.in,v 1.9 2006/02/11 14:31:14 xunsun Exp $
+       $Id: WAS.in,v 1.10 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -148,34 +148,6 @@
 }
 
 #
-#      Run:  Run a script, and log its output.
-#
-run() {
-  output=`"$@" 2>&1`
-  rc=$?
-  output=`echo $output`
-  if
-    [ $rc -eq 0 ]
-  then 
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log info "$output"
-    fi
-    return 0
-  else
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log "err" "$output"
-    else
-      ocf_log "err" "command failed: $*"
-    fi
-    return $rc
-  fi
-}
-
-#
 #      Reformat the XML document in a sort of canonical form
 #      if we can.  If we don't have xmllint, we just cat it out
 #      and hope for the best ;-)
@@ -376,7 +348,7 @@
     rc=$OCF_ERR_GENERIC
   fi
   rm -fr $tmpfile
-  return $rc
+  return_master $rc
 }
 
 #
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/WinPopup.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- WinPopup.in 20 Dec 2005 08:34:48 -0000      1.5
+++ WinPopup.in 9 Mar 2006 12:55:10 -0000       1.6
@@ -30,7 +30,7 @@
 
 usage() {
   echo "Usage: $0 {start|stop|status|monitor|validate-all|meta-data}"
-  echo "$Id: WinPopup.in,v 1.5 2005/12/20 08:34:48 zhenh Exp $"
+  echo "$Id: WinPopup.in,v 1.6 2006/03/09 12:55:10 xunsun Exp $"
 }
 
 meta_data() {
@@ -120,7 +120,7 @@
        ocf_log warn "Don't stat/monitor me! WinPopup is a pseudo resource 
agent, so the status reported may be incorrect"
        if [ -f $WINPOPUPFILE ]; then
                echo "running"
-               return $OCF_SUCCESS
+               return_master $OCF_SUCCESS
        else
                echo "stopped"
                return $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/Xinetd.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Xinetd.in   20 Dec 2005 08:34:48 -0000      1.8
+++ Xinetd.in   9 Mar 2006 12:55:10 -0000       1.9
@@ -138,7 +138,7 @@
 xup_status () {
        if [ -f $PIDFILE ]; then
                echo running
-               return $OCF_SUCCESS
+               return_master $OCF_SUCCESS
        else
                echo stopped
                return $OCF_NOT_RUNNING
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/apache.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- apache.in   11 Feb 2006 14:34:11 -0000      1.14
+++ apache.in   9 Mar 2006 12:55:10 -0000       1.15
@@ -126,33 +126,6 @@
 }
 
 #
-#      Run:  Run a script, and log its output.
-#
-run() {
-  output=`"$@" 2>&1`
-  rc=$?
-  output=`echo $output`
-  if
-    [ $rc -eq 0 ]
-  then 
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log info "$output"
-    fi
-    return $OCF_SUCCESS
-  else
-    if
-      [ ! -z "$output" ]
-    then
-      ocf_log err "$output"
-    else
-      ocf_log err "command failed: $*"
-    fi
-    return $OCF_ERR_GENERIC
-  fi
-}
-#
 # Strip comments, and initial blanks. Compress other blanks. Delete lines of 
blanks only.
 #
 apachecat() {
@@ -403,9 +376,10 @@
     silent_status
   then
     run sh -c "$WGET $WGETOPTS $STATUSURL | grep -i '</ *body *></ *html *>' 
>/dev/null"
+    return_master $?
   else
-    ocf_log err "$CMD not running"
-    return $OCF_ERR_GENERIC;
+    ocf_log info "$CMD not running"
+    return $OCF_NOT_RUNNING
   fi
 }
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/db2.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- db2.in      26 Jan 2006 18:00:05 -0000      1.8
+++ db2.in      9 Mar 2006 12:55:10 -0000       1.9
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: db2.in,v 1.8 2006/01/26 18:00:05 lars Exp $
+# $Id: db2.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
 # 
 # db2
 #
@@ -48,7 +48,7 @@
        The 'validate-all' operation reports whether the parameters are valid
        The 'methods' operation reports on the methods $0 supports
 
-       $Id: db2.in,v 1.8 2006/01/26 18:00:05 lars Exp $
+       $Id: db2.in,v 1.9 2006/03/09 12:55:10 xunsun Exp $
        !
 }
 
@@ -279,11 +279,11 @@
     else
       ocf_log err "DB2 UDB instance $1 DB $DB is not working"
       ocf_log err "DB2 UDB message: $output"
-      return $OCF_ERR_GENERIC
+      return `return_master $OCF_ERR_GENERIC`
     fi
   done
   ocf_log info "All DBs in DB2 UDB instance $1 appear to be working"
-  return $OCF_SUCCESS
+  return_master $OCF_SUCCESS
 }
 
 #
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/drbd.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- drbd.in     21 Dec 2005 05:36:52 -0000      1.18
+++ drbd.in     9 Mar 2006 12:55:10 -0000       1.19
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $Id: drbd.in,v 1.18 2005/12/21 05:36:52 zhenh Exp $
+#      $Id: drbd.in,v 1.19 2006/03/09 12:55:10 xunsun Exp $
 #
 #       OCF Resource Agent compliant drbd resource script.
 #
@@ -317,16 +317,16 @@
        if [ "$DRBD_STATE_LOCAL" != "Secondary" ] \
        && [ "$DRBD_STATE_LOCAL" != "Primary" ]; then
                ocf_log err "$RESOURCE monitor: unexpected local state: 
$DRBD_STATE_LOCAL"
-               return $OCF_ERR_GENERIC
+               return `return_master $OCF_ERR_GENERIC`
        fi
 
        ROLE="$OCF_RESKEY_role"
        if [ -n "$ROLE" ] && [ "$DRBD_STATE_LOCAL" != "$ROLE" ]; then
                ocf_log err "$RESOURCE monitor: wrong state: expected $ROLE != 
$DRBD_STATE_LOCAL"
-               return $OCF_ERR_GENERIC
+               return `return_master $OCF_ERR_GENERIC`
        fi
 
-       return $OCF_SUCCESS
+       return_master $OCF_SUCCESS
 }
 
 drbd_promote() {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ocf-shellfuncs.in,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- ocf-shellfuncs.in   18 Nov 2005 05:48:40 -0000      1.24
+++ ocf-shellfuncs.in   9 Mar 2006 12:55:10 -0000       1.25
@@ -1,5 +1,5 @@
 #
-#      $Id: ocf-shellfuncs.in,v 1.24 2005/11/18 05:48:40 alan Exp $
+#      $Id: ocf-shellfuncs.in,v 1.25 2006/03/09 12:55:10 xunsun Exp $
 #
 #      Common helper functions for the OCF Resource Agents supplied by
 #      heartbeat.
@@ -208,4 +208,46 @@
        ha_log "${__OCF_PRIO}: $__OCF_MSG"
 }
 
+return_master() {
+       if [ $# -ne 1 ]; then
+           return $OCF_ERR_GENERIC
+       fi
+       
+       rc=$1
+       if [ "${__OCF_ACTION}" = "monitor" -a "${OCF_RESKEY_interval}" = "0" ]; 
then
+           if [ "$rc" = "$OCF_SUCCESS" ]; then
+               return $OCF_RUNNING_MASTER
+           fi
+
+           if [ "$rc" = "$OCF_ERR_GENERIC" ]; then
+               return $OCF_FAILED_MASTER
+           fi
+       fi
+
+       return $rc
+}
+
+#
+# Run:  Run a script, and log its output.
+# Usage: run <command>
+#
+run() {
+       output=`"$@" 2>&1`
+       rc=$?
+       output=`echo $output`
+       if [ $rc -eq 0 ]; then 
+           if [ ! -z "$output" ]; then
+               ocf_log info "$output"
+           fi
+           return $OCF_SUCCESS
+       else
+           if [ ! -z "$output" ]; then
+               ocf_log err "$output"
+           else
+               ocf_log err "command failed: $*"
+           fi
+           return $OCF_ERR_GENERIC
+       fi
+}
+
 __ocf_set_defaults "$@"
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/portblock.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- portblock.in        20 Dec 2005 08:34:48 -0000      1.5
+++ portblock.in        9 Mar 2006 12:55:10 -0000       1.6
@@ -183,8 +183,8 @@
     chain_isactive "$1" "$2"
   then
     case $3 in
-         block)        SayActive $*; return $?;;
-         *)            SayInactive $*; return $?;;
+         block)        SayActive $*;;
+         *)            SayInactive $*;;
     esac
   else
     case $3 in
@@ -192,14 +192,16 @@
                if
                  pseudo_resource "$RSCNAME" status
                then
-                 SayConsideredActive $*; return $?
+                 SayConsideredActive $*
                else
-                 SayInactive $*; return $?
+                 SayInactive $*
                fi;;
 
-         *)    SayActive $*; return $?;;
+         *)    SayActive $*;;
     esac
   fi      
+
+  return_master $?
 }
 
 #IptablesBLOCK  {udp|tcp} portno,portno




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

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


End of Linux-ha-cvs Digest, Vol 28, Issue 13
********************************************

Reply via email to