Gentoo Archives: gentoo-commits

From: "Alexey Shvetsov (alexxy)" <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-fs/ocfs2-tools/files: ocfs2.initd ocfs2.confd
Date: Wed, 31 Aug 2011 17:15:30
Message-Id: 20110831171518.7D5CD20051@flycatcher.gentoo.org
1 alexxy 11/08/31 17:15:18
2
3 Added: ocfs2.initd ocfs2.confd
4 Log:
5 [sys-fs/ocfs2-tools] Reimport to tree
6
7 (Portage version: 2.2.0_alpha51/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 sys-fs/ocfs2-tools/files/ocfs2.initd
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.initd?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.initd?rev=1.1&content-type=text/plain
14
15 Index: ocfs2.initd
16 ===================================================================
17 #!/sbin/runscript
18 # Copyright 1999-2011 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20 # $Header: /var/cvsroot/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.initd,v 1.1 2011/08/31 17:15:18 alexxy Exp $
21
22 depend() {
23 need net localmount
24 before netmount
25 }
26
27 check_modules_config() {
28 local MODULES=$1
29 local CONFIGS=$2
30 local MODULE
31 local retval=0
32
33 for MODULE in ${MODULES}; do
34 if ! ls -1 /sys/module | egrep -q "^${MODULE}$"; then
35 retval=1
36 fi
37 done
38 if [ ${retval} -eq 1 ] && [ -e /proc/config.gz ]; then
39 retval=0
40 for MODULE in ${CONFIGS}; do
41 if ! gzip -dc /proc/config.gz | egrep -q "^CONFIG_${MODULE}=y$"; then
42 retval=1
43 fi
44 done
45 fi
46 return ${retval}
47 }
48
49 check_modules() {
50 check_modules_config "ocfs2_dlmfs ocfs2 ocfs2_dlm ocfs2_nodemanager" "OCFS2_FS OCFS2_FS_O2CB" && check_modules_config configfs CONFIGFS_FS && return 0
51 if ! egrep -q '\s*ocfs2\s*$' /proc/filesystems || ! egrep -q '\s*ocfs2_dlmfs\s*$' /proc/filesystems; then
52 ewarn "One or more required modules are not loaded."
53 ewarn "Make sure you have "
54 ewarn " - placed ocfs, dlmfs and configfs into /etc/modules.autoload.d/kernel-2.6 or built directly into the kernel."
55 ewarn "For a (in)complete documentation, read /usr/share/doc/ocfs-<version>/INSTALL.GENTOO.bz2"
56 fi
57 return 1
58 }
59
60 check_pseudofs() {
61 local retval=0
62 local HASMOUNT="mount -l -t"
63 if [ -z "`${HASMOUNT} configfs`" ] ; then
64 retval=1
65 fi
66 if [ -z "`${HASMOUNT} ocfs2_dlmfs`" ] ; then
67 retval=1
68 fi
69
70 if [ ${retval} -eq 1 ]; then
71 ewarn "One or more pseudo-filesystes are not mounted."
72 ewarn "Make sure you have following lines in your /etc/fstab:"
73 ewarn "none /sys/kernel/config configfs defaults 0 0"
74 ewarn "none /sys/kernel/dlm ocfs2_dlmfs defaults 0 0"
75 fi
76 return ${retval}
77 }
78
79
80
81 start() {
82 check_modules || return $?
83 check_pseudofs || return $?
84
85 einfo "Starting OCFS2 cluster"
86 for cluster in ${OCFS2_CLUSTER}; do
87 ebegin " - ${cluster}"
88 /sbin/o2cb_ctl -H -n ${cluster} -t cluster -a online=yes >/dev/null 2>&1
89 eend $?
90
91 # Some heartbeat tweaks to prevent self-fencing quite so much during heavy load.
92 # http://oss.oracle.com/projects/ocfs2/dist/documentation/ocfs2_faq.html
93
94 # How long to wait before a node is considered dead from lack of network activity.
95 echo $OCFS2_IDLE_TIMEOUT_MS > /sys/kernel/config/cluster/${cluster}/idle_timeout_ms
96 # How often we should attempt to send heartbeats.
97 echo $OCFS2_KEEPALIVE_DELAY_MS > /sys/kernel/config/cluster/${cluster}/keepalive_delay_ms
98 echo $OCFS2_RECONNECT_DELAY_MS > /sys/kernel/config/cluster/${cluster}/reconnect_delay_ms
99 # How many interations before a node is considered dead from lack of IO activity.
100 # (dead_threshold - 1) * 2s
101 echo $OCFS2_DEAD_THRESHOLD > /sys/kernel/config/cluster/${cluster}/heartbeat/dead_threshold
102 done
103 sleep 2
104 }
105
106 stop() {
107 # Shamelesly stolen from netmount
108 local ret
109 ebegin "Unmounting OCFS2 filesystems"
110 [ -z "$(umount -art ocfs2 2>&1)" ]
111 ret=$?
112 eend ${ret} "Failed to simply unmount filesystems"
113 [ ${ret} -eq 0 ] && return 0
114
115 declare -a siglist=( "TERM" "KILL" "KILL" )
116 local retry=0
117 local remaining="go"
118
119 while [ -n "${remaining}" -a ${retry} -lt 3 ]
120 do
121 remaining="$(awk '$3 ~ /'ocfs2'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
122 IFS=$'\n'
123 set -- ${remaining//\\040/ }
124 unset IFS
125 [ -z "${remaining}" ] && break
126
127 ebegin $'\t'"Unmounting ocfs2 filesystems (retry #$((retry+1)))"
128 /bin/fuser -k -${siglist[$((retry++))]} -m "$@" &>/dev/null
129 sleep 5
130 umount "$@" &>/dev/null
131 eend $? $'\t'"Failed to unmount filesystems"
132 done
133
134
135 einfo "Stopping OCFS2 cluster"
136 for cluster in ${OCFS_CLUSTERS}; do
137 ebegin " - ${cluster}"
138 /sbin/o2cb_ctl -H -n ${cluster} -t cluster -a online=no >/dev/null 2>&1
139 eend $?
140 done
141 }
142
143
144
145 1.1 sys-fs/ocfs2-tools/files/ocfs2.confd
146
147 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.confd?rev=1.1&view=markup
148 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.confd?rev=1.1&content-type=text/plain
149
150 Index: ocfs2.confd
151 ===================================================================
152 # Copyright 1999-2011 Gentoo Foundation
153 # Distributed under the terms of the GNU General Public License v2
154 # $Header: /var/cvsroot/gentoo-x86/sys-fs/ocfs2-tools/files/ocfs2.confd,v 1.1 2011/08/31 17:15:18 alexxy Exp $
155
156 # Put your cluster names here, separated by space, ie.
157 # OCFS2_CLUSTER="cluster1 admincluster cluster2"
158 OCFS2_CLUSTER="home"
159
160 # Some heartbeat tweaks to prevent self-fencing quite so much during heavy load.
161 # http://oss.oracle.com/projects/ocfs2/dist/documentation/ocfs2_faq.html
162
163 # How long to wait before a node is considered dead from lack of network activity.
164 OCFS2_IDLE_TIMEOUT_MS="30000"
165 # How often we should attempt to send heartbeats.
166 OCFS2_KEEPALIVE_DELAY_MS="2000"
167 OCFS2_RECONNECT_DELAY_MS="2000"
168 # How often we should attempt to send heartbeats.
169 # How many interations before a node is considered dead from lack of IO activity.
170 # (dead_threshold - 1) * 2s
171 OCFS2_DEAD_THRESHOLD="61"
172
173 # Default: "-fy" (force check on double-unmounted boot). I beleave this is best.
174 # Native way is "-y", but once I have twice reboot/powerOFF with bad result...
175 # Affected only fstab.
176 OCFS2_FSCK="-fy"
177
178 # http://oss.oracle.com/projects/ocfs2-tools/news/article_8.html
179 # starting from 1.4.3, fsck.ocfs2 "aggressively cache the metadata blocks"
180 # this is useful on lots of free memory, but I have heavy slowdown on x86_64
181 # with 1G of RAM.
182 # "yes" will "swapoff -a" & "swapon -a" around fsck to avoid caching over swap
183 OCFS2_FSCK_SWAPOFF="yes"
184
185 # Signal to kill processes on stop/umount on busy device (empty to not kill)
186 #OCFS2_UMOUNT_KILL="KILL"
187
188 # "yes" to force stop
189 #OCFS2_FORCE_STOP="no"