Commit 324cd7bf authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Jose A. Lopes

daemon-util: support for daemons loaded on demand

We add a second category of daemons in daemon-util, those that are
started on demand and should not be started by the start_all action, but
should be stopped during service shutdown. This category currently
includes metad and kvmd.

To this end we introduce two more array variables:

 - ON_DEMAND_DAEMONS: currently holds kvmd and metad, which should only
   be stopped during stop-all.

 - ALL_DAEMONS: is the union of DAEMONS and ON_DEMAND_DAEMONS, i.e. the
   list of all known daemons.

We also change the daemon-util test to expect kvmd and metad in the stop
daemon list.
Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent f437a5f8
......@@ -31,11 +31,17 @@ DAEMONS=(
ganeti-wconfd
ganeti-noded
ganeti-masterd
ganeti-metad
ganeti-rapi
ganeti-luxid
)
# This is the list of daemons that are loaded on demand; they should only be
# stopped, not started.
ON_DEMAND_DAEMONS=(
ganeti-metad
ganeti-kvmd
)
_confd_enabled() {
[[ "@CUSTOM_ENABLE_CONFD@" == True ]]
}
......@@ -52,6 +58,9 @@ if _mond_enabled; then
DAEMONS+=( ganeti-mond )
fi
# The full list of all daemons we know about
ALL_DAEMONS=( ${DAEMONS[@]} ${ON_DEMAND_DAEMONS[@]} )
NODED_ARGS=
MASTERD_ARGS=
CONFD_ARGS=
......@@ -175,15 +184,13 @@ list_start_daemons() {
local name
for name in "${DAEMONS[@]}"; do
if [[ "$name" != ganeti-metad ]]; then
echo "$name"
fi
echo "$name"
done
}
# Prints a list of all daemons in the order in which they should be stopped
list_stop_daemons() {
for name in "${DAEMONS[@]}"; do
for name in "${ALL_DAEMONS[@]}"; do
echo "$name"
done | tac
}
......@@ -197,7 +204,7 @@ is_daemon_name() {
local name="$1"; shift
for i in "${DAEMONS[@]}"; do
for i in "${ALL_DAEMONS[@]}"; do
if [[ "$i" == "$name" ]]; then
return 0
fi
......
......@@ -37,7 +37,7 @@ if ! grep -q '^ENABLE_MOND = ' lib/_constants.py; then
fi
DAEMONS_LIST="wconfd noded masterd rapi luxid"
STOPDAEMONS_LIST="luxid rapi metad masterd noded wconfd"
STOPDAEMONS_LIST="luxid rapi masterd noded wconfd"
if grep -q '^ENABLE_CONFD = True' lib/_constants.py; then
DAEMONS_LIST="$DAEMONS_LIST confd"
......@@ -49,6 +49,8 @@ if grep -q '^ENABLE_MOND = True' lib/_constants.py; then
STOPDAEMONS_LIST="mond $STOPDAEMONS_LIST"
fi
STOPDAEMONS_LIST="kvmd metad $STOPDAEMONS_LIST"
DAEMONS=$(echo $(for d in $DAEMONS_LIST; do echo "ganeti-$d"; done))
STOPDAEMONS=$(echo $(for d in $STOPDAEMONS_LIST; do echo "ganeti-$d"; done))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment