commit: 6ea96b2080d0903324e22a39400d23f1c7e1f71c Author: Benedikt Neuffer <gentoo <AT> itfriend <DOT> de> AuthorDate: Wed Feb 17 09:54:29 2021 +0000 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> CommitDate: Thu Feb 18 17:35:01 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ea96b20
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 <AT> itfriend.de> Closes: https://bugs.gentoo.org/770511 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> app-emulation/lxd/files/lxd-4.0.0.initd | 18 +++++++++++++----- 1 file 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 266e84fcef6..c55b2da6a84 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 }