Neutron: Use the pids subsystem to look up container id

Currently we rely on cgroup name to detect id of sidecar containers but
the name is not managed by podman and it is not guaranteed that it is
consistent with container id.
This changes switches the base record to the pid subsystem which is
actively managed by podman and more likely to be consistent with
container ids.

Closes-Bug: #1933918
Change-Id: Id57f86e62409e257f5619dc8b360cee3f922c805
This commit is contained in:
Takashi Kajinami 2021-06-29 14:04:18 +09:00
parent 8c9c94bf8b
commit b1e992a739
1 changed files with 1 additions and 1 deletions

View File

@ -52,7 +52,7 @@ signal_container() {
{% raw -%}
if [ -f /proc/$PID/cgroup ]; then
# Get container ID based on process cgroups
CT_ID=$(awk 'BEGIN {FS="[-.]"} /name=/{print $3}' /proc/$PID/cgroup)
CT_ID=$(awk 'BEGIN {FS="[-.]"} /:pids:/{print $3}' /proc/$PID/cgroup)
CT_NAME=$($CLI inspect -f '{{.Name}}' $CT_ID)
case $SIG in