summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexys Jacob <ultrabug@gentoo.org>2011-07-08 15:29:35 +0000
committerAlexys Jacob <ultrabug@gentoo.org>2011-07-08 15:29:35 +0000
commitfeb2361b680313e66c7c84aab02a5392d05889b6 (patch)
treef22029a52fae23bc70dd60162245aefb764bad70
parentMark the latest 0.23.1 as stable since I've been running it on both x86 and a... (diff)
downloadgentoo-2-feb2361b680313e66c7c84aab02a5392d05889b6.tar.gz
gentoo-2-feb2361b680313e66c7c84aab02a5392d05889b6.tar.bz2
gentoo-2-feb2361b680313e66c7c84aab02a5392d05889b6.zip
Enhanced init script, add an autorestore functionnality. Drop old.
(Portage version: 2.1.10.3/cvs/Linux x86_64)
-rw-r--r--sys-cluster/moosefs/ChangeLog10
-rw-r--r--sys-cluster/moosefs/files/mfs.confd10
-rw-r--r--sys-cluster/moosefs/files/mfs.initd50
-rw-r--r--sys-cluster/moosefs/moosefs-1.6.20-r1.ebuild (renamed from sys-cluster/moosefs/moosefs-1.6.20.ebuild)2
4 files changed, 58 insertions, 14 deletions
diff --git a/sys-cluster/moosefs/ChangeLog b/sys-cluster/moosefs/ChangeLog
index c48142bf7472..f5f48a2265fb 100644
--- a/sys-cluster/moosefs/ChangeLog
+++ b/sys-cluster/moosefs/ChangeLog
@@ -1,10 +1,10 @@
# ChangeLog for sys-cluster/moosefs
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/moosefs/ChangeLog,v 1.1 2011/07/05 07:45:36 ultrabug Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/moosefs/ChangeLog,v 1.2 2011/07/08 15:29:35 ultrabug Exp $
-*moosefs-1.6.20 (05 Jul 2011)
+*moosefs-1.6.20-r1 (08 Jul 2011)
- 05 Jul 2011; Ultrabug <ultrabug@gentoo.org> +moosefs-1.6.20.ebuild,
- +files/mfs.confd, +files/mfs.initd, +metadata.xml:
- Initial import. Thanks to Mike Kazantsev for his initial work on bug #338004.
+ 08 Jul 2011; Ultrabug <ultrabug@gentoo.org> -moosefs-1.6.20.ebuild,
+ +moosefs-1.6.20-r1.ebuild, files/mfs.confd, files/mfs.initd:
+ Enhanced init script, add an autorestore functionnality. Drop old.
diff --git a/sys-cluster/moosefs/files/mfs.confd b/sys-cluster/moosefs/files/mfs.confd
index 0dd704fb55e2..423795e33355 100644
--- a/sys-cluster/moosefs/files/mfs.confd
+++ b/sys-cluster/moosefs/files/mfs.confd
@@ -1,3 +1,11 @@
# Which mooseFS roles should we start ?
-# Possible values: mfsmetalogger mfschunkserver mfsmaster
+#
+# NOTE: The roles are stopped in *reverse* order of the given list
+# so make sure to list mfsmaster *before* the other roles.
+#
+# Possible values: mfsmaster mfsmetalogger mfschunkserver
#ROLES=""
+
+# If the role mfsmaster fails to start, should we try to run mfsmetarestore -a ?
+# Possible values: 0 (no), 1 (yes)
+AUTORESTORE=0 \ No newline at end of file
diff --git a/sys-cluster/moosefs/files/mfs.initd b/sys-cluster/moosefs/files/mfs.initd
index ccdf1df0a2d3..b08d50c5d5d1 100644
--- a/sys-cluster/moosefs/files/mfs.initd
+++ b/sys-cluster/moosefs/files/mfs.initd
@@ -15,14 +15,45 @@ chkconfig() {
return 0
}
+autorestore() {
+ einfo "AUTORESTORE set, trying to restore metadata files"
+ mfsmetarestore -a &>/dev/null
+ return $?
+}
+
+start_role() {
+ local ROLE=$1
+ local RETURN=0
+
+ ebegin "${ROLE}"
+ start-stop-daemon -q --start --exec "${ROLE}" -- start >/dev/null
+ RETURN=$?
+ eend ${RETURN}
+
+ return ${RETURN}
+}
+
start_roles() {
+ local RETURN=0
+
eindent
for ROLE in ${ROLES}; do
- einfo "${ROLE}"
- "${ROLE}" start 2>&1 | logger -s -p daemon.info -t mfs
+
+ start_role ${ROLE} || RETURN=$?
+ eend ${RETURN}
+
+ if [ "${RETURN}" != "0" ] && [ "${ROLE}" == "mfsmaster" ] && [ ${AUTORESTORE} -eq 1 ]; then
+ eindent
+ autorestore && start_role ${ROLE}
+ RETURN=$?
+ eoutdent
+ fi
+
+ [ "${RETURN}" != "0" ] && break
done
eoutdent
- return 0
+
+ return ${RETURN}
}
start() {
@@ -32,12 +63,17 @@ start() {
}
stop() {
+ local RETURN=0
+
ebegin "Stopping mfs node"
eindent
- for ROLE in ${ROLES}; do
- einfo "${ROLE}"
- "${ROLE}" stop 2>&1 | logger -s -p daemon.info -t mfs
+ local REVERSE=$(echo ${ROLES} | tac -s' ')
+ for ROLE in ${REVERSE}; do
+ ebegin "${ROLE}"
+ start-stop-daemon -q --stop -n ${ROLE} || RETURN=$?
+ eend ${RETURN}
done
eoutdent
- eend 0
+
+ eend ${RETURN}
}
diff --git a/sys-cluster/moosefs/moosefs-1.6.20.ebuild b/sys-cluster/moosefs/moosefs-1.6.20-r1.ebuild
index 1d8d7b920d31..1d21150c5b00 100644
--- a/sys-cluster/moosefs/moosefs-1.6.20.ebuild
+++ b/sys-cluster/moosefs/moosefs-1.6.20-r1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/moosefs/moosefs-1.6.20.ebuild,v 1.1 2011/07/05 07:45:36 ultrabug Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/moosefs/moosefs-1.6.20-r1.ebuild,v 1.1 2011/07/08 15:29:35 ultrabug Exp $
EAPI=4