summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorgnidorah <gnidorah@users.noreply.github.com>2018-10-18 22:35:15 +0300
committergnidorah <gnidorah@users.noreply.github.com>2018-10-18 22:35:32 +0300
commita6603fd8a8a058e957fd5cc17302f3efb6c9b839 (patch)
tree0caae4efb625221b32b6aecfafdef5fcddc9556a /nixos
parent32bcd72bf28a971c9063a9cdcc32effe49f49331 (diff)
downloadnixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar.gz
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar.bz2
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar.lz
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar.xz
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.tar.zst
nixpkgs-a6603fd8a8a058e957fd5cc17302f3efb6c9b839.zip
kvmgt module: add service restart on failure
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/kvmgt.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/kvmgt.nix b/nixos/modules/virtualisation/kvmgt.nix
index fc0bedb68bd..132815a0ad6 100644
--- a/nixos/modules/virtualisation/kvmgt.nix
+++ b/nixos/modules/virtualisation/kvmgt.nix
@@ -50,11 +50,17 @@ in {
       nameValuePair "kvmgt-${name}" {
         description = "KVMGT VGPU ${name}";
         serviceConfig = {
-          Type = "oneshot";
+          Type = "forking";
           RemainAfterExit = true;
+          Restart = "on-failure";
+          RestartSec = 5;
           ExecStart = "${pkgs.runtimeShell} -c 'echo ${value.uuid} > /sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create'";
           ExecStop = "${pkgs.runtimeShell} -c 'echo 1 > /sys/bus/pci/devices/${cfg.device}/${value.uuid}/remove'";
         };
+        unitConfig = {
+          StartLimitBurst = 5;
+          StartLimitIntervalSec = 30;
+        };
         wantedBy = [ "multi-user.target" ];
       }
     ) cfg.vgpus;