Skip to content

Commit

Permalink
[Windows] Support OF port state "blocked" when installing Pod forward…
Browse files Browse the repository at this point in the history
…ing rules

On Windows, OVS has an issue which doesn't correctly update the port status
after an OpenFlow port is successfully installed. So OVS may send out PortStatus
message with Port state as BLOCKED, this issue doesn't impact on the datapath
forwarding.

This change is a workaround to ensure Pod's OpenFlow entries are installed as
long as the OpenFlow port is allocated.

Signed-off-by: Wenying Dong <[email protected]>
  • Loading branch information
wenyingd committed Dec 30, 2024
1 parent 0e9d0f0 commit 5991c27
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/agent/cniserver/pod_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,21 @@ func (pc *podConfigurator) recordPodEvent(ifConfig *interfacestore.InterfaceConf
}

func (pc *podConfigurator) processPortStatusMessage(status *openflow15.PortStatus) {
// Update Pod OpenFlow entries only after the OpenFlow port state is live.
if status.Desc.State != openflow15.PS_LIVE {
ofPort := status.Desc.PortNo
state := status.Desc.State
// Update Pod OpenFlow entries only after the OpenFlow port state is live or blocked.
// Accepting Port state "openflow15.PS_BLOCKED" is a workaround for Windows OVS issue https://github.com/openvswitch/ovs-issues/issues/351.
// In which OVS does not correctly implement function netdev_windows_update_flags, so OVS doesn't update ifp_flags
// after a new OpenFlow port is successfully installed. Since this OVS issue doesn't have side impact on datapath
// packets forwarding, antrea-agent will ignore the bad state to ensure the Pod's OpenFlow entries are installed as
// long as the port number is allocated.
if status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED {

Check failure on line 688 in pkg/agent/cniserver/pod_configuration.go

View workflow job for this annotation

GitHub Actions / Golangci-lint (macos-latest)

bools: suspect or: status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED (govet)

Check failure on line 688 in pkg/agent/cniserver/pod_configuration.go

View workflow job for this annotation

GitHub Actions / Golangci-lint (ubuntu-latest)

bools: suspect or: status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED (govet)

Check failure on line 688 in pkg/agent/cniserver/pod_configuration.go

View workflow job for this annotation

GitHub Actions / Go benchmark test

suspect or: status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED

Check failure on line 688 in pkg/agent/cniserver/pod_configuration.go

View workflow job for this annotation

GitHub Actions / Unit test (ubuntu-latest)

suspect or: status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED

Check failure on line 688 in pkg/agent/cniserver/pod_configuration.go

View workflow job for this annotation

GitHub Actions / Unit test (windows-2022)

suspect or: status.Desc.State != openflow15.PS_LIVE || status.Desc.State != openflow15.PS_BLOCKED
klog.Info("Ignoring the OVS port status message with undesired state", "ofPort", ofPort, "state", state)
return
}

ovsPort := string(bytes.Trim(status.Desc.Name, "\x00"))
ofPort := status.Desc.PortNo
klog.InfoS("Processing OVS port status message", "ovsPort", ovsPort, "ofPort", ofPort, "state", status.Desc.State)

ifConfig, found := pc.ifaceStore.GetInterfaceByName(ovsPort)
if !found {
Expand Down

0 comments on commit 5991c27

Please sign in to comment.