diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2019-06-17 16:32:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 16:32:54 +0100 |
commit | 55e2c850a3f8df60f0cc3d83d4acdb222657df81 (patch) | |
tree | 2cbbc98108611c9c76371aa6537c0a2a02cab4a4 /nixos/modules/virtualisation | |
parent | 2b51328002dd38ff706cecd3855cd502d08c76a1 (diff) | |
parent | eac62f61d17181a82292a18fa1bfb46bafe33487 (diff) | |
download | nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar.gz nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar.bz2 nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar.lz nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar.xz nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.tar.zst nixlib-55e2c850a3f8df60f0cc3d83d4acdb222657df81.zip |
nixos/kvmgt: fix starting condition (#62096)
nixos/kvmgt: fix starting condition
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/kvmgt.nix | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/nixos/modules/virtualisation/kvmgt.nix b/nixos/modules/virtualisation/kvmgt.nix index 132815a0ad63..bfcf51d09c45 100644 --- a/nixos/modules/virtualisation/kvmgt.nix +++ b/nixos/modules/virtualisation/kvmgt.nix @@ -46,22 +46,24 @@ in { message = "KVMGT is not properly supported for kernels older than 4.16"; }; boot.kernelParams = [ "i915.enable_gvt=1" ]; + systemd.paths = mapAttrs' (name: value: + nameValuePair "kvmgt-${name}" { + description = "KVMGT VGPU ${name} path"; + wantedBy = [ "multi-user.target" ]; + pathConfig = { + PathExists = "/sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create"; + }; + } + ) cfg.vgpus; systemd.services = mapAttrs' (name: value: nameValuePair "kvmgt-${name}" { description = "KVMGT VGPU ${name}"; serviceConfig = { - Type = "forking"; + Type = "oneshot"; 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; }; |