From de5389d14c04d8d87a9841aa01536df1d1198953 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Fri, 25 Oct 2024 12:11:44 -0400 Subject: [PATCH] control if profiling is restricted only to admin users or not --- site/profile/manifests/gpu.pp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/site/profile/manifests/gpu.pp b/site/profile/manifests/gpu.pp index 85eaf1b16..ced828e53 100644 --- a/site/profile/manifests/gpu.pp +++ b/site/profile/manifests/gpu.pp @@ -20,7 +20,8 @@ } class profile::gpu::install ( - String $lib_symlink_path = undef + String $lib_symlink_path = undef, + Boolean $allow_profiling_for_all = false ) { ensure_resource('file', '/etc/nvidia', { 'ensure' => 'directory' }) ensure_packages(['kernel-devel'], { 'ensure' => 'installed' }) @@ -63,6 +64,21 @@ require => $kmod_require, } + if $allow_profiling_for_all { + file { '/etc/modprobe.d/nvidia.conf': + ensure => file, + owner => 'root', + group => 'root', + mode => '0755', + } + file_line { 'allow_profiling_for_all': + path => '/etc/modprobe.d/nvidia.conf', + line => 'options nvidia NVreg_RestrictProfilingToAdminUsers=0', + require => File['/etc/modprobe.d/nvidia.conf'], + before => (if ! $facts['nvidia_grid_gpu'] { Class['profile::gpu::install::passthrough'] } else { Class['profile::gpu::install::vgpu'] }), + } + } + if $lib_symlink_path { $lib_symlink_path_split = split($lib_symlink_path, '/') $lib_symlink_dir = Hash(