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:
@@ -57,6 +57,17 @@ qemuArgs = "qemu-system-x86_64"
|
||||
vncPort = 5900
|
||||
snapshots = true
|
||||
|
||||
# Resource limits. Only works on Linux, with `Delegate=yes` set in your .service file.
|
||||
#
|
||||
# cpuUsageMax specifies CPU usage limits in the common top notation, so 200% means 2 CPUs, so on so forth.
|
||||
# runOnCpus specifies what CPUs the VM is allowed to run on.
|
||||
#
|
||||
# Either can be omitted or specified; however, if you want to disable it entirely,
|
||||
# it's a better idea to just comment this inline table out,
|
||||
# since the inline table existing is used to enable cgroup support.
|
||||
resourceLimits = { cpuUsageMax = 100, runOnCpus = [ 2, 4 ] }
|
||||
|
||||
|
||||
# VNC options
|
||||
# Only used if vm.type is set to "vncvm"
|
||||
[vncvm]
|
||||
|
||||
Reference in New Issue
Block a user