Skip to content

Commit

Permalink
nixos on hyperv: hot-add CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg committed Sep 28, 2018
1 parent ca6d41a commit 6e3e136
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nixos/modules/virtualisation/hyperv-guest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ in {

security.rngd.enable = false;

# enable hotadding memory
# enable hotadding cpu/memory
services.udev.packages = lib.singleton (pkgs.writeTextFile {
name = "hyperv-memory-hotadd-udev-rules";
destination = "/etc/udev/rules.d/99-hyperv-memory-hotadd.rules";
name = "hyperv-cpu-and-memory-hotadd-udev-rules";
destination = "/etc/udev/rules.d/99-hyperv-cpu-and-memory-hotadd.rules";
text = ''
ACTION="add", SUBSYSTEM=="memory", ATTR{state}="online"
# Memory hotadd
SUBSYSTEM=="memory", ACTION=="add", DEVPATH=="/devices/system/memory/memory[0-9]*", TEST=="state", ATTR{state}="online"
# CPU hotadd
SUBSYSTEM=="cpu", ACTION=="add", DEVPATH=="/devices/system/cpu/cpu[0-9]*", TEST=="online", ATTR{online}="1"
'';
});

Expand Down

0 comments on commit 6e3e136

Please sign in to comment.