-
Notifications
You must be signed in to change notification settings - Fork 75
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
Containers: detect systemd-nspawn
and add a fallback module
#302
Open
intelfx
wants to merge
12
commits into
liske:master
Choose a base branch
from
intelfx:work/systemd-other
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ignore $ppid if it is an instance of the systemd manager. This prevents `systemd --user` from being treated as a parent process of all non-double-forked `systemd --user` services.
Ideally, we'd do something more reasonable, like treating them similarly to system services and maybe even offering to restart some of them or at the very least printing them in a format suitable for copy-pasting, but for now just replace the process name with the service name and save them under a separate key to hopefully distinguish them from other processes under `systemd --user`.
There is no need for get_pidns() to be a method of the CONT class. Additionally, rename the function to nr_get_pid_ns() because it's the "PID namespace", not "namespace PID" we are getting, and the old name is confusing.
Same reason as 46d40fa ("CONT, Utils: move get_pidns() into utils, rename to nr_get_pid_ns()"). Additionally, cleanup usage of pidns and move repeated checks into the base class.
intelfx
force-pushed
the
work/systemd-other
branch
from
April 25, 2024 11:41
c2c8e20
to
6b6bf5c
Compare
Ideally, this should be served by a separate module, but the restart interface is the same, so it lives here for now. Also, tighten up cgroup matching to avoid capturing any subcgroups as part of the container name.
Add a special container detection module that runs after all other modules and checks if the process is in a different PID namespace. This module only implements check() and does not offer any restart actions. It only serves to detect processes that are likely to belong to containers, which are then omitted from regular output and are not acted upon any further.
intelfx
force-pushed
the
work/systemd-other
branch
from
April 25, 2024 11:48
6b6bf5c
to
c3909d8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is on top of #301.
This PR does two things:
CONT::machined
module to also check for systemd-nspawn containers (which is slightly dirty, but I opted to keep it in the same module for now because the restart call is the same);CONT::other
module that runs after all others to detect any containers of unknown type by pidns.