]> git.openstreetmap.org Git - chef.git/commitdiff
devices: enable nvme.poll_queues if supported
authorGrant Slater <github@firefishy.com>
Fri, 19 Apr 2024 14:11:41 +0000 (15:11 +0100)
committerGrant Slater <github@firefishy.com>
Fri, 19 Apr 2024 14:11:55 +0000 (15:11 +0100)
cookbooks/devices/recipes/default.rb
cookbooks/devices/templates/default/nvme.conf.erb [new file with mode: 0644]

index 8572dd232755abde2ca33c1187deb69d98b14f6a..c19acda9bf5772f9d54b9d7c943441217a117785 100644 (file)
@@ -35,3 +35,17 @@ template "/etc/udev/rules.d/99-chef.rules" do
   mode "644"
   notifies :run, "execute[udevadm-trigger]"
 end
+
+template "/etc/modprobe.d/nvme.conf" do
+  source "nvme.conf.erb"
+  owner "root"
+  group "root"
+  mode "644"
+  only_if { File.exist?("/sys/module/nvme/parameters/poll_queues") }
+end
+
+execute "update-initramfs" do
+  action :nothing
+  command "/usr/sbin/update-initramfs -u"
+  subscribes :run, "template[/etc/modprobe.d/nvme.conf]"
+end
diff --git a/cookbooks/devices/templates/default/nvme.conf.erb b/cookbooks/devices/templates/default/nvme.conf.erb
new file mode 100644 (file)
index 0000000..9c90d93
--- /dev/null
@@ -0,0 +1,3 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+options nvme poll_queues=4