From b9dc818bd55ef4314da10d09297d7f51f0d3e6a9 Mon Sep 17 00:00:00 2001 From: rnhmjoj <rnhmjoj@inventati.org> Date: Sun, 28 Feb 2021 14:02:42 +0100 Subject: [PATCH] nixos/lxd: make start timeout configurable --- nixos/modules/virtualisation/lxd.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix index d7e94cc3b39b..d686cb503d86 100644 --- a/nixos/modules/virtualisation/lxd.nix +++ b/nixos/modules/virtualisation/lxd.nix @@ -74,6 +74,17 @@ in { for details. ''; }; + + startTimeout = mkOption { + type = types.int; + default = 600; + apply = toString; + description = '' + Time to wait (in seconds) for LXD to become ready to process requests. + If LXD does not reply within the configured time, lxd.service will be + considered failed and systemd will attempt to restart it. + ''; + }; }; }; @@ -120,7 +131,7 @@ in { serviceConfig = { ExecStart = "@${cfg.package}/bin/lxd lxd --group lxd"; - ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=600"; + ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=${cfg.startTimeout}"; ExecStop = "${cfg.package}/bin/lxd shutdown"; KillMode = "process"; # when stopping, leave the containers alone @@ -130,7 +141,7 @@ in { TasksMax = "infinity"; Restart = "on-failure"; - TimeoutStartSec = "600s"; + TimeoutStartSec = "${cfg.startTimeout}s"; TimeoutStopSec = "30s"; # By default, `lxd` loads configuration files from hard-coded