Make host-device to work with virtio net device
In case pciBusID contains pci address of the virtio device, then lookup the net directory under virtio<id> directory. Issue: https://github.com/containernetworking/plugins/issues/320 Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
This commit is contained in:
parent
f5c3d1b1ba
commit
a9b4e04bc4
@ -296,7 +296,12 @@ func getLink(devname, hwaddr, kernelpath, pciaddr string) (netlink.Link, error)
|
||||
} else if len(pciaddr) > 0 {
|
||||
netDir := filepath.Join(sysBusPCI, pciaddr, "net")
|
||||
if _, err := os.Lstat(netDir); err != nil {
|
||||
return nil, fmt.Errorf("no net directory under pci device %s: %q", pciaddr, err)
|
||||
virtioNetDir := filepath.Join(sysBusPCI, pciaddr, "virtio*", "net")
|
||||
matches, err := filepath.Glob(virtioNetDir)
|
||||
if matches == nil || err != nil {
|
||||
return nil, fmt.Errorf("no net directory under pci device %s", pciaddr)
|
||||
}
|
||||
netDir = matches[0]
|
||||
}
|
||||
fInfo, err := ioutil.ReadDir(netDir)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user