3
0
Fork 0
forked from mirrors/nixpkgs

kvmgt module: add service restart on failure

This commit is contained in:
gnidorah 2018-10-18 22:35:15 +03:00
parent 32bcd72bf2
commit a6603fd8a8

View file

@ -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;