summaryrefslogtreecommitdiff
blob: a6c9520491bb5d551562b79217020dc3192f0def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/ganeti/files/ganeti.initd,v 1.1 2007/11/23 12:45:00 hansmi Exp $

depend() {
	need localmount xend drbd
	after bootmisc
}

checkconfig() {
	for fname in /var/lib/ganeti/ssconf_node_pass /var/lib/ganeti/server.pem
	do
		if [[ ! -f "$fname" ]]
		then
			eerror "Config file $fname not found, will not run."
			return 1
		fi
	done

	return 0
}

start() {
	checkconfig || return 1

	ebegin "Starting ganeti-master"
	/usr/sbin/ganeti-master start
	ret=$?
	eend ${ret}
	[[ "${ret}" != 0 ]] && return 1

	ebegin "Starting ganeti-noded"
	start-stop-daemon --start --quiet --exec /usr/sbin/ganeti-noded
	ret=$?
	eend ${ret}
	[[ "${ret}" != 0 ]] && return 1

	return 0
}

stop() {
	ebegin "Stopping ganeti-noded"
	start-stop-daemon --stop --quiet --name ganeti-noded
	ret=$?
	eend ${ret}
	[[ "${ret}" != 0 ]] && return 1

	ebegin "Stopping ganeti-master"
	/usr/sbin/ganeti-master start
	ret=$?
	eend ${ret}
	[[ "${ret}" != 0 ]] && return 1

	return 0
}