cvmts: Add support for cgroup process resource limits on Linux

Using systemd's `Delegate=` option, it is possible to get it to let you manage your own cgroup subtree, therefore allowing you to set options and other fun stuff.

This commit adds support for doing so and configuring the resource limits in config.toml.

For later: The cgroup created has to be a threaded one. Iin theory, we can actually wait for the QEMU process to handshake qmp, grab the vCPU threads, and only limit those. For now, just limiting the entire QEMU process works, though and is the least complicated.

NOTE: Windows support should still work, even if you have resource limits configured. If you do, it should only warn and complain, but still function.
This commit is contained in:
modeco80
2024-11-02 06:08:26 -04:00
parent bbc873a113
commit e780ecabf0
6 changed files with 222 additions and 3 deletions

View File

@@ -81,7 +81,7 @@ async function start() {
vncPort: Config.qemu.vncPort,
};
VM = new QemuVMShim(def);
VM = new QemuVMShim(def, Config.qemu.resourceLimits);
break;
}
case 'vncvm': {