mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 01:39:48 +00:00
Merge pull request #851 from amshinde/modify-driver-fetch
vfio: Change the way the driver is fetched
This commit is contained in:
commit
2c2a60faf1
@ -8,6 +8,7 @@ package virtcontainers
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -148,12 +149,15 @@ func createPhysicalEndpoint(netInfo NetworkInfo) (*PhysicalEndpoint, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Driver
|
// Get driver by following symlink /sys/bus/pci/devices/$bdf/driver
|
||||||
driver, err := ethHandle.DriverName(netInfo.Iface.Name)
|
driverPath := filepath.Join(sysPCIDevicesPath, bdf, "driver")
|
||||||
|
link, err := os.Readlink(driverPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driver := filepath.Base(link)
|
||||||
|
|
||||||
// Get vendor and device id from pci space (sys/bus/pci/devices/$bdf)
|
// Get vendor and device id from pci space (sys/bus/pci/devices/$bdf)
|
||||||
|
|
||||||
ifaceDevicePath := filepath.Join(sysPCIDevicesPath, bdf, "device")
|
ifaceDevicePath := filepath.Join(sysPCIDevicesPath, bdf, "device")
|
||||||
|
Loading…
Reference in New Issue
Block a user