nixos/lxd-virtual-machine: enable CPU hotplug for x86 VMs
This commit is contained in:
parent
b2cd5e15fb
commit
76c69af624
2 changed files with 13 additions and 0 deletions
|
@ -45,6 +45,10 @@ in {
|
|||
|
||||
boot.kernelParams = ["console=tty1" "console=${serialDevice}"];
|
||||
|
||||
services.udev.extraRules = ''
|
||||
SUBSYSTEM=="cpu", CONST{arch}=="x86-64", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
|
||||
'';
|
||||
|
||||
virtualisation.lxd.agent.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -57,5 +57,14 @@ in
|
|||
|
||||
with subtest("lxd-agent has a valid path"):
|
||||
machine.succeed("incus exec ${instance-name} -- bash -c 'true'")
|
||||
|
||||
with subtest("guest supports cpu hotplug"):
|
||||
machine.succeed("incus config set ${instance-name} limits.cpu=1")
|
||||
count = int(machine.succeed("incus exec ${instance-name} -- nproc").strip())
|
||||
assert count == 1, f"Wrong number of CPUs reported, want: 1, got: {count}"
|
||||
|
||||
machine.succeed("incus config set ${instance-name} limits.cpu=2")
|
||||
count = int(machine.succeed("incus exec ${instance-name} -- nproc").strip())
|
||||
assert count == 2, f"Wrong number of CPUs reported, want: 2, got: {count}"
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue