mirror of
https://github.com/containers/podman.git
synced 2025-12-05 21:32:22 +08:00
commit 1951ff168a introduced a check so
that conmon is not moved to a new cgroup when podman is running inside
of a systemd service. This is helpful to integrate podman in systemd
so that the spawned conmon lives in the same cgroup as the service
that created it.
Unfortunately this breaks when podman daemon is running in a systemd
service since the same check is in place thus all the conmon processes
end up in the same cgroup as the podman daemon. When the podman
daemon systemd service stops the conmon processes are also terminated
as well as the containers they monitor.
Improve the check to exclude podman running as a daemon.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2052697
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
35 lines
687 B
Bash
35 lines
687 B
Bash
# -*- bash -*-
|
|
#
|
|
# BATS helpers for systemd-related functionality
|
|
#
|
|
|
|
# podman initializes this if unset, but systemctl doesn't
|
|
if [ -z "$XDG_RUNTIME_DIR" ]; then
|
|
if is_rootless; then
|
|
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
|
fi
|
|
fi
|
|
|
|
# For tests which write systemd unit files
|
|
UNIT_DIR="/run/systemd/system"
|
|
_DASHUSER=
|
|
if is_rootless; then
|
|
UNIT_DIR="${XDG_RUNTIME_DIR}/systemd/user"
|
|
# Why isn't systemd smart enough to figure this out on its own?
|
|
_DASHUSER="--user"
|
|
fi
|
|
|
|
mkdir -p $UNIT_DIR
|
|
|
|
systemctl() {
|
|
command systemctl $_DASHUSER "$@"
|
|
}
|
|
|
|
journalctl() {
|
|
command journalctl $_DASHUSER "$@"
|
|
}
|
|
|
|
systemd-run() {
|
|
command systemd-run $_DASHUSER "$@";
|
|
}
|