Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Use Windows management virtual network adapter for OVS bridge #3067

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

wenyingd
Copy link
Contributor

Rename the vnic created by Windows host when creating the HNS Network as
the OVS bridge name, and add OVS internal port for the bridge port. Then
OVS uses the vnic created by Windows host directly, and IP/MAC/route
migrations is not needed. With this workflow, the time of losing IP on
the Windows host is cut off.

Fixes #3057

Signed-off-by: wenying wenyingd@vmware.com

@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2021

Codecov Report

Merging #3067 (5de6594) into main (c2f3670) will decrease coverage by 8.07%.
The diff coverage is 0.00%.

❗ Current head 5de6594 differs from pull request most recent head 55c9640. Consider uploading reports for the commit 55c9640 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3067      +/-   ##
==========================================
- Coverage   58.88%   50.81%   -8.08%     
==========================================
  Files         302      293       -9     
  Lines       25864    35110    +9246     
==========================================
+ Hits        15230    17841    +2611     
- Misses       8950    15579    +6629     
- Partials     1684     1690       +6     
Flag Coverage Δ
e2e-tests 50.81% <0.00%> (?)
kind-e2e-tests ?
unit-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/interfacestore/types.go 75.00% <0.00%> (+2.27%) ⬆️
pkg/ipfix/ipfix_intermediate.go 0.00% <0.00%> (-89.48%) ⬇️
pkg/controller/egress/controller.go 0.00% <0.00%> (-88.45%) ⬇️
pkg/controller/networkpolicy/endpoint_querier.go 4.58% <0.00%> (-86.85%) ⬇️
pkg/ipfix/ipfix_collector.go 0.00% <0.00%> (-81.82%) ⬇️
pkg/agent/util/iptables/lock.go 0.00% <0.00%> (-81.82%) ⬇️
pkg/controller/ipam/antrea_ipam_controller.go 0.00% <0.00%> (-80.29%) ⬇️
pkg/controller/ipam/validate.go 0.00% <0.00%> (-80.00%) ⬇️
pkg/agent/cniserver/ipam/antrea_ipam_controller.go 0.00% <0.00%> (-79.77%) ⬇️
pkg/flowaggregator/certificate.go 0.00% <0.00%> (-76.58%) ⬇️
... and 293 more

@wenyingd wenyingd force-pushed the ovs_host_port branch 2 times, most recently from b1a26a9 to b3b18e3 Compare November 30, 2021 09:10
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have enough context to be the sole reviewer, but this LGTM.
Out of curiosity, did you test your change and did you observe a significant improvement in downtime?

pkg/agent/util/net_windows.go Outdated Show resolved Hide resolved
Comment on lines 145 to 137
// Rename the vnic created by Windows host with the OVS bridge name, then it can be used by OVS directly.
if err := util.RenameVMNetworkAdapter(hnsNetwork.Name, uplinkMACStr, brName); err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we never need to undo this change? deleting the HNSNetwork will still take care of all the clean-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, the vnic created by Windows host is removed even if we have renamed it when the HNSNetwork is removed.

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I understood all the changes. Would you update Windows design doc too reflect the changes?

@wenyingd
Copy link
Contributor Author

wenyingd commented Dec 1, 2021

I don't have enough context to be the sole reviewer, but this LGTM. Out of curiosity, did you test your change and did you observe a significant improvement in downtime?

With our original implementation, the Windows IP address of the uplink address (e.g., we name it as Ethernet0) is lost when we created the HNSNetwork, and then came back after the virtual adapter is created by Windows, then it dismissed again when we removed the vnic until we configured it on the OVS bridge. Using this PR, the IP address is lost only when creating the HNS Network. I have tried to ping the IP address inside the Windows host, and its lost time can be reduced to 1s with this PR, while it lost about 20-30 seconds in the original implementation.

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

docs/design/windows-design.md Outdated Show resolved Hide resolved
docs/design/windows-design.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should change "vnic" in the commit message to "virtual network adapter".

docs/design/windows-design.md Outdated Show resolved Hide resolved
docs/design/windows-design.md Show resolved Hide resolved
@wenyingd wenyingd force-pushed the ovs_host_port branch 2 times, most recently from 44fb592 to b5f9e41 Compare December 2, 2021 07:13
@wenyingd wenyingd changed the title [Windows] Use Windows management vnic for OVS bridge [Windows] Use Windows management virual network adapter for OVS bridge Dec 2, 2021
@wenyingd wenyingd changed the title [Windows] Use Windows management virual network adapter for OVS bridge [Windows] Use Windows management virtual network adapter for OVS bridge Dec 2, 2021
@wenyingd
Copy link
Contributor Author

wenyingd commented Dec 2, 2021

/test-integration
/test-all
/test-windows-all
/skip-ipv6-all
/skip-ipv6-only-all

@@ -67,6 +67,9 @@ func TestRouteOperation(t *testing.T) {
},
}
called := false
getOVSBridgeInterfaceNameFunc = func(bridge string) string {
return bridge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the test needs to change getOVSBridgeInterfaceNameFunc in this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case is actually using the network adapter name directly, which doesn't need a prefix "vEthernet"

pkg/agent/agent_windows.go Show resolved Hide resolved
pkg/agent/agent_windows.go Show resolved Hide resolved
return err
}
if hypervEnabled {
if err := RemoveManagementInterface(LocalHNSNetwork); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the step that removes the vnic we use since this PR?
Do we still need the two functions? WindowsHyperVEnabled and RemoveManagementInterface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveManagementInterface is not needed any more (and I would remove it), but WindowsHyperVEnabled is used in the integration test for HyperV features check on the setup.

@@ -142,6 +142,10 @@ func (i *Initializer) prepareOVSBridge() error {
if _, err = i.ovsBridgeClient.GetOFPort(brName, false); err == nil {
klog.Infof("OVS bridge local port %s already exists, skip the configuration", brName)
} else {
// Rename the vnic created by Windows host with the OVS bridge name, then it can be used by OVS directly.
if err = util.RenameVMNetworkAdapter(hnsNetwork.Name, uplinkMACStr, brName); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we rename it to br-int, it will actually get vEthernet (br-int)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

br-int is actually a name of VMNetworkAdapter, but the name of the NetAdapter is "vEthernet (br-int)".

@wenyingd wenyingd force-pushed the ovs_host_port branch 2 times, most recently from 1dd7803 to 14ae92e Compare December 3, 2021 01:47
@wenyingd
Copy link
Contributor Author

wenyingd commented Dec 3, 2021

/test-windows-all
/test-all
/skip-ipv6-all
/skip-ipv6-all

@wenyingd
Copy link
Contributor Author

wenyingd commented Dec 9, 2021

/test-integration
/test-windows-all
/test-all
/skip-ipv6-all
/skip-ipv6-only-all

@wenyingd wenyingd requested a review from tnqn December 9, 2021 10:41
@wenyingd
Copy link
Contributor Author

/test-windows-all

@wenyingd
Copy link
Contributor Author

@tnqn @jianjuns Any other comments on this PR?

@jianjuns
Copy link
Contributor

LGTM

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, some nits

pkg/agent/util/net_windows.go Outdated Show resolved Hide resolved
pkg/agent/util/net_windows.go Show resolved Hide resolved
pkg/agent/util/net_windows.go Outdated Show resolved Hide resolved
@wenyingd
Copy link
Contributor Author

wenyingd commented Jan 7, 2022

/test-windows-all

@wenyingd wenyingd force-pushed the ovs_host_port branch 2 times, most recently from 71353b1 to 55c9640 Compare January 18, 2022 02:22
@wenyingd
Copy link
Contributor Author

Rebase code on TOT and resolve the conflict.
Code change is only about Windows, so skip IPv6 relavant tests. Used to manually verified on Windows setup.

/test-windows-all
/test-windows-proxyall-e2e
/test-all
/skip-ipv6-all
/skip-ipv6-only-all

@wenyingd wenyingd requested a review from tnqn January 18, 2022 02:29
@wenyingd
Copy link
Contributor Author

/test-windows-all
/test-all
/test-windows-proxyall-e2e

@wenyingd
Copy link
Contributor Author

/test-e2e
/test-networkpolicy

@tnqn tnqn added this to the Antrea v1.5 release milestone Jan 18, 2022
tnqn
tnqn previously approved these changes Jan 18, 2022
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Rename the vnic created by Windows host when creating the HNS Network as
the OVS bridge name, and add OVS internal port for the bridge port. Then
OVS uses the vnic created by Windows host directly, and IP/MAC/route
migrations is not needed. With this workflow, the time of losing IP on
the Windows host is reduced.

Signed-off-by: wenying <wenyingd@vmware.com>
@wenyingd
Copy link
Contributor Author

/test-windows-all
/test-all
/test-windows-proxyall-e2e
/test-integration
/skip-ipv6-all
/skip-ipv6-only-all

@wenyingd
Copy link
Contributor Author

/test-windows-conformance

@wenyingd wenyingd requested a review from tnqn January 18, 2022 11:26
@wenyingd
Copy link
Contributor Author

/test-e2e

@tnqn
Copy link
Member

tnqn commented Jan 19, 2022

/skip-e2e failure is unrelated

@tnqn tnqn merged commit 7dd8d86 into antrea-io:main Jan 19, 2022
yanjunz97 pushed a commit to yanjunz97/antrea that referenced this pull request Feb 14, 2022
…ge (antrea-io#3067)

Rename the vnic created by Windows host when creating the HNS Network as
the OVS bridge name, and add OVS internal port for the bridge port. Then
OVS uses the vnic created by Windows host directly, and IP/MAC/route
migrations is not needed. With this workflow, the time of losing IP on
the Windows host is reduced.

Signed-off-by: wenyingd <wenyingd@vmware.com>
@wenyingd wenyingd deleted the ovs_host_port branch August 15, 2022 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows: Time gap between Ethernet0 being removed and br-int starting
5 participants