summaryrefslogtreecommitdiff
blob: 5d8dedfe89dd2da2961dee44f7fd0b6ab0e9bb36 (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
diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
index 7636fc9..e93370f 100644
--- a/daemons/daemon-util.in
+++ b/daemons/daemon-util.in
@@ -31,25 +31,28 @@ set -e
 
 @SHELL_ENV_INIT@
 
-readonly defaults_file="$SYSCONFDIR/default/ganeti"
-
-# This is a list of all daemons and the order in which they're started. The
-# order is important as there are dependencies between them. On shutdown,
-# they're stopped in reverse order.
-DAEMONS=(
-  ganeti-noded
-  ganeti-confd
-  ganeti-wconfd
-  ganeti-rapi
-  ganeti-luxid
-  ganeti-kvmd
-  )
+readonly defaults_file="$SYSCONFDIR/conf.d/ganeti"
 
 # This is the list of daemons that are loaded on demand; they should only be
 # stopped, not started.
 ON_DEMAND_DAEMONS=(
   ganeti-metad
   )
+DAEMONS=( ganeti-noded ganeti-confd )
+
+_is_master() {
+        [ -z "${GANETI_MASTER}" ] && GANETI_MASTER="$(gnt-cluster getmaster)"
+        [ -z "${LOCAL_HOSTNAME}" ] && LOCAL_HOSTNAME="$(hostname -f)"
+        [ "${GANETI_MASTER}" = "${LOCAL_HOSTNAME}" ]
+}
+
+if _is_master; then
+  DAEMONS+=( ganeti-wconfd ganeti-rapi ganeti-luxid )
+else
+  DAEMONS+=( ganeti-rapi )
+fi
+
+DAEMONS+=( ganeti-kvmd )
 
 _mond_enabled() {
   [[ "@CUSTOM_ENABLE_MOND@" == True ]]