diff options
author | Benedikt Neuffer <gentoo@itfriend.de> | 2021-02-17 10:54:29 +0100 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2021-02-18 19:35:01 +0200 |
commit | 6ea96b2080d0903324e22a39400d23f1c7e1f71c (patch) | |
tree | f169680673d7a03d9c9e9b767f06aa3ec9f56343 /app-emulation/lxd | |
parent | app-text/dvisvgm: Stabilize 2.11-r1 sparc, #771249 (diff) | |
download | gentoo-6ea96b2080d0903324e22a39400d23f1c7e1f71c.tar.gz gentoo-6ea96b2080d0903324e22a39400d23f1c7e1f71c.tar.bz2 gentoo-6ea96b2080d0903324e22a39400d23f1c7e1f71c.zip |
app-emulation/lxd: use signals in openrc script
Rework on openrc script to use signals to communicate with the LXD daemon.
Bug: https://bugs.gentoo.org/770511
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Benedikt Neuffer <ogelpre@itfriend.de>
Closes: https://bugs.gentoo.org/770511
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'app-emulation/lxd')
-rw-r--r-- | app-emulation/lxd/files/lxd-4.0.0.initd | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app-emulation/lxd/files/lxd-4.0.0.initd b/app-emulation/lxd/files/lxd-4.0.0.initd index 266e84fcef64..c55b2da6a84d 100644 --- a/app-emulation/lxd/files/lxd-4.0.0.initd +++ b/app-emulation/lxd/files/lxd-4.0.0.initd @@ -28,12 +28,20 @@ start() { } stop() { - if [[ ${RC_GOINGDOWN} = YES ]] || [[ ${RC_REBOOT} = YES ]]; then - "${DAEMON}" shutdown - rm -f ${PIDFILE} + if [[ "${RC_CMD}" = restart ]]; then + ebegin "Stopping lxd service (but not containers)" + # start-stop-daemon sends SIGTERM with a timeout of 5s by default. + # SIGTERM indicates to LXD that it will be stopped temporarily. + # Instances will keep running. + start-stop-daemon --stop --quiet -p "${PIDFILE}" + eend ${?} else - ebegin "Stopping lxd service (but not containers)." - start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + ebegin "Stopping lxd service and containers, waiting 40s" + # SIGPWR indicates to LXD that the host is going down. + # LXD will do a clean shutdown of all instances. + # After 30s all remaining instances will be killed. + # We wait up to 40s for LXD. + start-stop-daemon --stop --quiet -R SIGPWR/40 -p "${PIDFILE}" eend ${?} fi } |