summaryrefslogtreecommitdiff
blob: 79bda3c989f32a5295227d5c2b539d36f65c80ec (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
diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
index 6a47253..5d7c4cf 100644
--- a/daemons/daemon-util.in
+++ b/daemons/daemon-util.in
@@ -31,18 +31,24 @@ set -e
 
 @SHELL_ENV_INIT@
 
-readonly defaults_file="$SYSCONFDIR/default/ganeti"
+readonly defaults_file="$SYSCONFDIR/conf.d/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-wconfd
-  ganeti-rapi
-  ganeti-luxid
-  ganeti-kvmd
-  )
+DAEMONS=( ganeti-noded ) 
+
+_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 )
+fi
+
+DAEMONS+=( ganeti-kvmd )
 
 # This is the list of daemons that are loaded on demand; they should only be
 # stopped, not started.