File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -191,23 +191,15 @@ func (m *nvlibVGPUConfigManager) getVGPUTypeNumberforVFIO(filePath string, vgpuT
191191}
192192
193193func (m * nvlibVGPUConfigManager ) IsVFIOEnabled () (bool , error ) {
194- vfioDistributions := map [string ]string {
195- "ubuntu" : "24.04" ,
196- "rhel" : "10" ,
197- }
198- // Read from the host's /etc/os-release (mounted at /host in the container)
199- data , err := os .ReadFile ("/host/etc/os-release" )
194+ // Check if mdev_bus exists and has entries
195+ mdevBusPath := "/sys/class/mdev_bus"
196+
197+ entries , err := os .ReadDir (mdevBusPath )
200198 if err != nil {
201- return false , fmt .Errorf ("unable to read host OS release info : %v" , err )
199+ return false , fmt .Errorf ("unable to read mdev_bus directory : %v" , err )
202200 }
203201
204- content := string (data )
205- for distribution , version := range vfioDistributions {
206- if strings .Contains (content , distribution ) && strings .Contains (content , version ) {
207- return true , nil
208- }
209- }
210- return false , nil
202+ return len (entries ) == 0 , nil
211203}
212204
213205// GetVGPUConfig gets the 'VGPUConfig' currently applied to a GPU at a particular index
You can’t perform that action at this time.
0 commit comments