Skip to content

Commit

Permalink
fix: Skip MAC address Settings when PCI addresse is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
fanriming committed Nov 15, 2021
1 parent 5518218 commit 4e4d95d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"os"
"path/filepath"
"regexp"
"strings"
"syscall"
"time"
Expand All @@ -24,6 +25,8 @@ import (
"github.com/kubeovn/kube-ovn/pkg/util"
)

var pciAddrRegexp = regexp.MustCompile(`\b([0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}.\d{1}\S*)`)

func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, containerID, vfDriver, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute bool, routes []request.Route, ingress, egress, priority, DeviceID, nicType, podNetns string, checkGw bool) error {
var err error
var hostNicName, containerNicName string
Expand Down Expand Up @@ -115,7 +118,7 @@ func (csh cniServerHandler) deleteNic(podName, podNamespace, containerID, device
if err = netlink.LinkDel(hostLink); err != nil {
return fmt.Errorf("delete host link %s failed %v", hostLink, err)
}
} else {
} else if pciAddrRegexp.MatchString(deviceID) {
// Ret VF index from PCI
vfIndex, err := sriovnet.GetVfIndexByPciAddress(deviceID)
if err != nil {
Expand Down

0 comments on commit 4e4d95d

Please sign in to comment.