File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,29 @@ import (
99)
1010
1111const (
12- defaultTotalVFFile = "sriov_totalvfs"
1312 defaultConfiguredVFFile = "sriov_numvfs"
13+ defaultVFCheckFile = "sriov_vf_device"
1414)
1515
16- // IsDeviceSRIOVCapable checks for existence of `sriov_totalvfs ` file in the pcidevice tree
16+ // IsDeviceSRIOVCapable checks for existence of `sriov_vf_device ` file in the pcidevice tree
1717func IsDeviceSRIOVCapable (devicePath string ) (bool , error ) {
18- _ , err := os .Stat (filepath .Join (devicePath , defaultTotalVFFile ))
18+ vfCheckFilePath := filepath .Join (devicePath , defaultVFCheckFile )
19+ _ , err := os .Stat (vfCheckFilePath )
1920 if err != nil {
2021 if os .IsNotExist (err ) {
2122 return false , nil
2223 }
2324 return false , err
2425 }
2526
27+ contents , err := os .ReadFile (vfCheckFilePath )
28+ if err != nil {
29+ return false , err
30+ }
31+
32+ if strings .TrimSuffix (string (contents ), "\n " ) == "0" {
33+ return false , nil
34+ }
2635 return true , nil
2736}
2837
You can’t perform that action at this time.
0 commit comments