Skip to content

Commit

Permalink
chore: add logs to sriov interface
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Jul 22, 2020
1 parent 6756e48 commit 63fbc00
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 63fbc00

Please sign in to comment.