[Ultrapossum-cvs 730] ultrapossum/module/failover ...

Back to archive index

Masato Taruishi taru****@users*****
2004年 10月 8日 (金) 15:40:20 JST


===================================================================
RCS file: ultrapossum/module/failover/11failover,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ultrapossum/module/failover/11failover	2004/10/04 10:43:41	1.7
+++ ultrapossum/module/failover/11failover	2004/10/08 06:40:20	1.8
@@ -55,6 +55,19 @@
 # Load balancer
 LOADBALANCER=$(ultrapossum_getconf LOADBALANCER localhost)
 
+# NFS
+
+FSTAB=$(ultrapossum_getconf FSTAB "/etc/fstab")
+VFSTAB=$(ultrapossum_getconf VFSTAB "/etc/vfstab")
+
+if test `uname` != "SunOS"; then
+  NFSDIR=$(ultrapossum_getconf NFSDIR "`grep nfs $FSTAB | awk -F' ' '{print $2;}' | head -1`")
+  NFSDEVICE=$(ultrapossum_getconf NFSDEVICE "`grep nfs $FSTAB | awk -F' ' '{print $1;}' | head -1`")
+else
+  NFSDIR=$(ultrapossum_getconf NFSDIR "`grep nfs $VFSTAB | awk -F' ' '{print $3;}' | head -1`")
+  NFSDEVICE=$(ultrapossum_getconf NFSDEVICE "`grep nfs $VFSTAB | awk -F' ' '{print $1;}' | head -1`")
+fi
+
 BACKUP=$(ultrapossum_getconf BACKUP "")
 
 fi # cache
===================================================================
RCS file: ultrapossum/module/failover/failover.cf,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ultrapossum/module/failover/failover.cf	2004/09/29 12:15:03	1.6
+++ ultrapossum/module/failover/failover.cf	2004/10/08 06:40:20	1.7
@@ -3,18 +3,25 @@
 # Virtual IP for master service
 #VIRTUAL="192.168.0.254"
 
+# Backup host for failover
+#BACKUP=backup
+
 ###
 ### NFS Configuration
 ###
 
-# Backup host for failover
-#BACKUP=backup
+# NFS device
+#NFSDEVICE="nfs:/nfs"
 
 # NFS mount point for data consistency
 #NFSDIR="/var/autofs/misc/share"
 
 # Replication Log Directory
 #RPLDIR="/service/ldap"
+
+###
+### Service Monitoring Configuration
+###
 
 # time in second to check wether the LDAP service available
 #FAILOVER_LDAP_INTERVAL=10
===================================================================
RCS file: ultrapossum/module/failover/update-failover,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ultrapossum/module/failover/update-failover	2004/09/27 09:07:56	1.15
+++ ultrapossum/module/failover/update-failover	2004/10/08 06:40:20	1.16
@@ -112,6 +112,47 @@
   fi
 }
 
+sanity_fstab() {
+  if test `uname` = "SunOS"; then
+    :
+  else
+    if test "x$BACKUP" != "x" && ! grep $NFSDIR $FSTAB > /dev/null 2> /dev/null; then
+      if test "x$NFSDIR" = "x" || test "x$NFSDEVICE" = "x"; then
+        echo "E: No NFS configuration in $FSTAB" 1>&2
+	exit 1
+      fi
+    fi
+  fi
+}
+
+configure_fstab() {
+  progress "Configuring NFS... "
+  if test `uname` = "SunOS"; then
+    :
+  else
+    if test "x$BACKUP" != "x" && test "x$TYPE" = "xmaster"; then
+      if ! grep $NFSDIR $FSTAB > /dev/null 2> /dev/null; then
+        add_startmark "##" "FAILOVER" > $tmp
+        echo "$NFSDEVICE	$NFSDIR	nfs	rw	0	0" >> $tmp
+        add_endmark "##" "FAILOVER" >> $tmp
+        add_end_vaconf $FSTAB $tmp "FAILOVER"
+      fi
+    else
+      remove_fstab
+    fi
+  fi
+  progress "Configuring NFS... done"
+}
+
+remove_fstab() {
+  if test `uname` = "SunOS"; then
+    :
+  else
+    strip_vaconf $FSTAB "FAILOVER"
+  fi
+}
+
+
 sanity_check() {
   sanity_error=0
   if test "x$TYPE" = "xmaster" && test "x$BACKUP" != "x"; then
@@ -174,6 +215,7 @@
       fi
     fi
   fi
+  sanity_fstab
   if test "$sanity_error" != "0"; then
     exit 1
   fi
@@ -189,6 +231,12 @@
 
   configure_mon
   configure_heartbeat
+
+  if test "x$NFSDIR" != "x" && test "x$NFSDEVICE" != "x"; then
+    configure_fstab
+  else
+    remove_fstab
+  fi
 
 }
 



Ultrapossum-cvs メーリングリストの案内
Back to archive index