about summary refs log tree commit diff
path: root/nixos/modules/virtualisation/hyperv-guest.nix
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2018-09-28 22:27:52 +0800
committerPeter Hoeg <peter@hoeg.com>2018-09-28 22:28:26 +0800
commit6e3e136f77b3103a0c3b3fe7578c5864932b649c (patch)
tree88e989720cf09edbbb408285f88021438cc3dd5c /nixos/modules/virtualisation/hyperv-guest.nix
parentca6d41ae654386562ef7f00ae268e6e9070a3f49 (diff)
downloadnixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar.gz
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar.bz2
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar.lz
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar.xz
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.tar.zst
nixlib-6e3e136f77b3103a0c3b3fe7578c5864932b649c.zip
nixos on hyperv: hot-add CPU
Diffstat (limited to 'nixos/modules/virtualisation/hyperv-guest.nix')
-rw-r--r--nixos/modules/virtualisation/hyperv-guest.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/nixos/modules/virtualisation/hyperv-guest.nix b/nixos/modules/virtualisation/hyperv-guest.nix
index d86cb9fe1ab9..0f1f052880c5 100644
--- a/nixos/modules/virtualisation/hyperv-guest.nix
+++ b/nixos/modules/virtualisation/hyperv-guest.nix
@@ -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"
       '';
     });