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

pkg/netns: some netns improvements #2168

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Sep 20, 2024

see commits, marking as draft until I ported in podman and passed CI there

Create a new function to create the netns dir.

Signed-off-by: Paul Holzinger <[email protected]>
There are some rather bad problems when we bind mount over multiple
times, this is a rather small race but can happen. In order to avoid
this take an exclusive lock like ip netns add does because they create
the same bind mount setup. As such we will not race against other podman
process or ip netns add which is a good thing.

Signed-off-by: Paul Holzinger <[email protected]>
The new API should replace the logic from Podman's setupNetNS() which
did several things incorrect. First and foremost it never bind mounted
the netns dir causing problems when the netns dir was later bind mounted
duplicating the netns mounts on diffeent parents which then caused all
unmount attempts to fail[1].

Also the Podman code did never check for conlicts so we way end up
overwriting an existing netns (super unlikely as we use 16 random bytes
but still). At the very least it duplicates the name logic for no reason
there so having this all here makes much more sense.

Of course we still have to port podman over to this new API.

[1] https://issues.redhat.com/browse/RHEL-59620

Signed-off-by: Paul Holzinger <[email protected]>
This API is not used anywhere, as such remove it and make the loop in
NewNS() better as the netns dir parts should not be part of the loop.

Signed-off-by: Paul Holzinger <[email protected]>
Copy link

We were not able to find or create Copr project packit/containers-common-2168 specified in the config with the following error:

Packit received HTTP 500 Internal Server Error from Copr Service. Check the Copr status page: https://copr.fedorainfracloud.org/status/stats/, or ask for help in Fedora Build System matrix channel: https://matrix.to/#/#buildsys:fedoraproject.org.

Unless the HTTP status code above is >= 500, please check your configuration for:

  1. typos in owner and project name (groups need to be prefixed with @)
  2. whether the project name doesn't contain not allowed characters (only letters, digits, underscores, dashes and dots must be used)
  3. whether the project itself exists (Packit creates projects only in its own namespace)
  4. whether Packit is allowed to build in your Copr project
  5. whether your Copr project/group is not private

@Luap99
Copy link
Member Author

Luap99 commented Sep 20, 2024

@giuseppe PTAL

@Luap99 Luap99 changed the title pkg/netns: some netns improvments pkg/netns: some netns improvements Sep 20, 2024
@Luap99
Copy link
Member Author

Luap99 commented Sep 20, 2024

Podman PR: containers/podman#24024

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Luap99 Luap99 marked this pull request as ready for review September 20, 2024 12:35
@rhatdan
Copy link
Member

rhatdan commented Sep 20, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Sep 20, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit e56b89d into containers:main Sep 20, 2024
16 checks passed
@Luap99 Luap99 deleted the netns-dir branch September 20, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants