public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Joonas Niilola" <juippis@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxd/files/
Date: Thu, 18 Feb 2021 17:35:09 +0000 (UTC)	[thread overview]
Message-ID: <1613669701.6ea96b2080d0903324e22a39400d23f1c7e1f71c.juippis@gentoo> (raw)

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
 }


             reply	other threads:[~2021-02-18 17:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 17:35 Joonas Niilola [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-15 21:56 [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxd/files/ Conrad Kostecki
2021-03-07  6:32 Joonas Niilola
2021-02-16 12:16 Joonas Niilola
2021-02-16 12:16 Joonas Niilola
2021-02-16  8:33 Joonas Niilola
2017-09-21 12:41 Amy Liffey
2015-11-16  2:54 Erik Mackdanz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1613669701.6ea96b2080d0903324e22a39400d23f1c7e1f71c.juippis@gentoo \
    --to=juippis@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox