Skip to content

Commit

Permalink
Merge pull request #419 from alauda/chore/sriov-logs
Browse files Browse the repository at this point in the history
chore: add logs to sriov interface
  • Loading branch information
oilbeater authored Jul 22, 2020
2 parents 6756e48 + 63fbc00 commit 7ecfe73
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ func configureHostNic(nicName, vlanID string, macAddr net.HardwareAddr) error {
return fmt.Errorf("can not find host nic %s %v", nicName, err)
}

if err = netlink.LinkSetHardwareAddr(hostLink, macAddr); err != nil {
return fmt.Errorf("can not set mac address to host nic %s %v", nicName, err)
}
if hostLink.Attrs().OperState != netlink.OperUp {
if err = netlink.LinkSetUp(hostLink); err != nil {
return fmt.Errorf("can not set host nic %s up %v", nicName, err)
Expand Down Expand Up @@ -375,6 +372,7 @@ func setupSriovInterface(containerID, deviceID string, mtu int) (string, string,
// 1. get VF netdevice from PCI
vfNetdevices, err := sriovnet.GetNetDevicesFromPci(deviceID)
if err != nil {
klog.Errorf("failed to get vf netdevice %s, %v", deviceID, err)
return "", "", err
}

Expand All @@ -387,18 +385,21 @@ func setupSriovInterface(containerID, deviceID string, mtu int) (string, string,
// 2. get Uplink netdevice
uplink, err := sriovnet.GetUplinkRepresentor(deviceID)
if err != nil {
klog.Errorf("failed to get up %s link device, %v", deviceID, err)
return "", "", err
}

// 3. get VF index from PCI
vfIndex, err := sriovnet.GetVfIndexByPciAddress(deviceID)
if err != nil {
klog.Errorf("failed to get vf %s index, %v", deviceID, err)
return "", "", err
}

// 4. lookup representor
rep, err := sriovnet.GetVfRepresentor(uplink, vfIndex)
if err != nil {
klog.Errorf("failed to get vf %d representor, %v", vfIndex, err)
return "", "", err
}
oldHostRepName := rep
Expand Down

0 comments on commit 7ecfe73

Please sign in to comment.