Skip to content

Linux Network Devices #4538

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Linux Network Devices #4538

wants to merge 2 commits into from

Conversation

aojea
Copy link

@aojea aojea commented Nov 21, 2024

Implementation of opencontainers/runtime-spec#1271

It implements the new proposal to the OCI spec to be able to specify Network Devices that get attached/detached from the containers

@aojea aojea force-pushed the netdevices branch 2 times, most recently from 07d3b0b to 3833056 Compare December 2, 2024 15:40
Copy link

@kad kad left a comment

Choose a reason for hiding this comment

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

LGTM. We are also interested in this use case for our accelerator devices.

@aojea aojea force-pushed the netdevices branch 2 times, most recently from 67f12e0 to d114afe Compare December 12, 2024 07:15
@aojea aojea force-pushed the netdevices branch 2 times, most recently from ec90a02 to f4f5d02 Compare December 20, 2024 12:11
@aojea aojea force-pushed the netdevices branch 2 times, most recently from 735f9d5 to ce1f612 Compare January 14, 2025 09:47
@aojea aojea force-pushed the netdevices branch 4 times, most recently from 6262c5e to c530772 Compare February 6, 2025 09:55
@aojea aojea force-pushed the netdevices branch 5 times, most recently from 4380e86 to f53d263 Compare February 10, 2025 21:27
@rata
Copy link
Member

rata commented Feb 25, 2025

@aojea friendly reminder that this should be ready soon, we are cutting 1.3.0-rc.1 soon (maybe this week). The spec part is still not sure when it will be merged?

Copy link
Member

@rata rata left a comment

Choose a reason for hiding this comment

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

@aojea I think the bug we were talking on slack is a bug in the validator, see the comments for more info.

@aojea aojea force-pushed the netdevices branch 2 times, most recently from f74c032 to 17c7056 Compare March 3, 2025 22:09
@aojea aojea force-pushed the netdevices branch 2 times, most recently from 9f4b286 to 20f65c5 Compare March 3, 2025 22:37
Copy link
Member

@rata rata left a comment

Choose a reason for hiding this comment

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

Thanks, it really helps to validate the runtime-spec change is not missing anything.

Left some nit comments. I don't think we should address them now, but before merging this :)

@aojea aojea force-pushed the netdevices branch 5 times, most recently from 1193b12 to 0809631 Compare March 27, 2025 13:50
@aojea aojea force-pushed the netdevices branch 2 times, most recently from 14a603d to a92b31b Compare April 1, 2025 11:21
@aojea aojea changed the title [RFC] Linux Network Devices Linux Network Devices Apr 1, 2025
Copy link
Member

@rata rata left a comment

Choose a reason for hiding this comment

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

Had a quick look, I'll review in detail later. Thanks again for the PR!

Comment on lines +855 to +858
for name, netDevice := range p.config.Config.NetDevices {
err := devChangeNetNamespace(name, nsPath, *netDevice)
if err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what we should do if moving some ifaces work but some fail. Shall we move back to the init netns the ones that we moved to the container?

To be clear, this is an honest question, I don't know what would be the right thing to do. Maybe keep them in the new netns is the right thing, as the kernel will move it back whenever the netns is destroyed and we the code here is quite simple. But if we decide to do that, I'd put a comment here.

Comment on lines +845 to +847
// host network pods does not move network devices.
if !p.config.Config.Namespaces.Contains(configs.NEWNET) {
return nil
Copy link
Member

Choose a reason for hiding this comment

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

I think you already fail in the config validate if there is no netns.

This might be useful for libct users, but for runc this should never happen.

Copy link
Author

Choose a reason for hiding this comment

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

should I remove it then?

aojea added 2 commits April 9, 2025 19:01
Change-Id: I2f000a2d8440257d9d81192bf073cc5d971039cc
Signed-off-by: Antonio Ojea <[email protected]>
Implement support for passing Linux Network Devices to the container
network namespace.

The network device is passed during the creation of the container,
before the process is started.

It implements the logic defined in the OCI runtime specification.

Signed-off-by: Antonio Ojea <[email protected]>
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.

5 participants