[lxc-devel] [lxd/master] lxd-agent: Support for `systemd-notify`

stgraber on Github lxc-bot at linuxcontainers.org
Tue Apr 21 23:47:40 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200421/3ac68c5b/attachment.bin>
-------------- next part --------------
From 472a8a2b4f3a69b48be9cbb08e441e8896d3c9a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 21 Apr 2020 19:46:27 -0400
Subject: [PATCH 1/2] lxd-agent: Support systemd-notify
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd-agent/main_agent.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd-agent/main_agent.go b/lxd-agent/main_agent.go
index 7f64ccd163..659dfb47e3 100644
--- a/lxd-agent/main_agent.go
+++ b/lxd-agent/main_agent.go
@@ -102,6 +102,11 @@ func (c *cmdAgent) Run(cmd *cobra.Command, args []string) error {
 	// Mount shares from host.
 	c.mountHostShares()
 
+	// Done with early setup, tell systemd to continue boot.
+	if os.Getenv("NOTIFY_SOCKET") != "" {
+		shared.RunCommand("systemd-notify", "READY=1")
+	}
+
 	// Load the kernel driver.
 	err = util.LoadModule("vsock")
 	if err != nil {

From eaa4613d6b3c0e17f9fe131f16d1f1de4451ae28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 21 Apr 2020 19:47:08 -0400
Subject: [PATCH 2/2] lxd/qemu: Switch default unit type to notify
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/instance/drivers/driver_qemu.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 35ee186f78..0848fa9e02 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -1279,7 +1279,7 @@ Before=cloud-init.target cloud-init.service cloud-init-local.service
 DefaultDependencies=no
 
 [Service]
-Type=simple
+Type=notify
 WorkingDirectory=/run/lxd_config/9p
 ExecStart=/run/lxd_config/9p/lxd-agent
 Restart=on-failure


More information about the lxc-devel mailing list