Merge pull request #14596 from giuseppe/move-conmon-different-cgroup-system-service

libpod: improve check to create conmon cgroup
This commit is contained in:
openshift-ci[bot] 2022-06-15 16:18:18 +00:00 committed by GitHub
commit ed755cb14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 1 deletions

View File

@ -1435,7 +1435,7 @@ func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec
} }
// $INVOCATION_ID is set by systemd when running as a service. // $INVOCATION_ID is set by systemd when running as a service.
if os.Getenv("INVOCATION_ID") != "" { if ctr.runtime.RemoteURI() == "" && os.Getenv("INVOCATION_ID") != "" {
mustCreateCgroup = false mustCreateCgroup = false
} }

View File

@ -362,4 +362,29 @@ EOF
run_podman 1 pod exists test_pod run_podman 1 pod exists test_pod
} }
@test "podman-system-service containers survive service stop" {
skip_if_remote "N/A under podman-remote"
SERVICE_NAME=podman-service-$(random_string)
port=$(random_free_port)
URL=tcp://127.0.0.1:$port
systemd-run --unit=$SERVICE_NAME $PODMAN system service $URL --time=0
wait_for_port 127.0.0.1 $port
# Start a long-running container.
cname=keeps-running
run_podman --url $URL run -d --name $cname $IMAGE top -d 2
run_podman container inspect -l --format "{{.State.Running}}"
is "$output" "true" "This should never fail"
systemctl stop $SERVICE_NAME
run_podman container inspect $cname --format "{{.State.Running}}"
is "$output" "true" "Container is still running after podman server stops"
run_podman rm -f -t 0 $cname
}
# vim: filetype=sh # vim: filetype=sh

View File

@ -28,3 +28,7 @@ systemctl() {
journalctl() { journalctl() {
command journalctl $_DASHUSER "$@" command journalctl $_DASHUSER "$@"
} }
systemd-run() {
command systemd-run $_DASHUSER "$@";
}