fix(services-restart): an LXC container's processes are left out, 4.46.0 (NetOrk/netork#2750) #134

Merged
christianmanivong merged 4 commits from feature/services-need-restart-lxc into main 2026-11-26 18:56:35 +00:00
Owner

Stacked on #132 (4.45.0, head a38f075): this branch merges #132's head and releases 4.46.0 on top of it. Merge it after #132.

Why. Wiring ServicesRestartMixin into napalm-proxmox (NetOrk/netork#2750, NAPALM/napalm-proxmox#77) makes a Proxmox VE node the first host whose /proc scan sees LXC containers' processes. A container updates itself. After its own apt upgrade, its nginx maps a deleted libssl, and its cgroup, 0::/lxc/<vmid>/ns/system.slice/nginx.service, would make nginx a host service that needs a restart. Docker and Podman were already left out (_container). LXC was not.

What.

  • _maps also leaves out a process whose cgroup is under /lxc/<name>/ (Proxmox VE, which nests the container's own cgroups under ns; cgroup v1) or /lxc.payload.<name>/ (LXC 4 and later).
  • /lxc.monitor/<name> still counts: lxc-start runs the host's binary.
  • The listening sockets' _container is unchanged: a container's sockets live in its own network namespace, which the host's ss does not show.
  • Docstring, README, and a 4.46.0 "Fixed" entry.

Tests. tests/test_services_restart.py: an LXC container's processes are left out (four cgroup forms), and the monitor counts. Whole suite locally: 1932 passed, 3 skipped. ruff clean.

Version. 4.46.0, the next free one after #132's 4.45.0. I re-checked the tags (v4.44.0 is the latest) and the open branches right before the release commit. CI is expected to be red until 4.45.0 is released, as for #132's dependants.

**Stacked on #132** (4.45.0, head a38f075): this branch merges #132's head and releases **4.46.0** on top of it. Merge it after #132. **Why.** Wiring `ServicesRestartMixin` into napalm-proxmox (NetOrk/netork#2750, NAPALM/napalm-proxmox#77) makes a Proxmox VE node the first host whose `/proc` scan sees LXC containers' processes. A container updates itself. After its own `apt upgrade`, its nginx maps a deleted libssl, and its cgroup, `0::/lxc/<vmid>/ns/system.slice/nginx.service`, would make `nginx` a *host* service that needs a restart. Docker and Podman were already left out (`_container`). LXC was not. **What.** - `_maps` also leaves out a process whose cgroup is under `/lxc/<name>/` (Proxmox VE, which nests the container's own cgroups under `ns`; cgroup v1) or `/lxc.payload.<name>/` (LXC 4 and later). - `/lxc.monitor/<name>` still counts: `lxc-start` runs the host's binary. - The listening sockets' `_container` is unchanged: a container's sockets live in its own network namespace, which the host's `ss` does not show. - Docstring, README, and a 4.46.0 "Fixed" entry. **Tests.** `tests/test_services_restart.py`: an LXC container's processes are left out (four cgroup forms), and the monitor counts. Whole suite locally: 1932 passed, 3 skipped. ruff clean. **Version.** 4.46.0, the next free one after #132's 4.45.0. I re-checked the tags (v4.44.0 is the latest) and the open branches right before the release commit. CI is expected to be red until 4.45.0 is released, as for #132's dependants.
christianmanivong changed title from fix(services-restart): an LXC container's processes are left out (NetOrk/netork#2750) to fix(services-restart): an LXC container's processes are left out, 4.46.0 (NetOrk/netork#2750) 2026-11-26 18:27:36 +00:00
christianmanivong changed target branch from feature/services-need-restart to main 2026-11-26 18:27:36 +00:00
christianmanivong added 8 commits 2026-11-26 18:27:36 +00:00
ServicesRestartMixin.get_services_need_restart reads, as root and in one
fixed read-only command, which systemd services still run code an update
replaced on disk: needs-restarting -s on the dnf family, else needrestart
in batch list-only mode (-r l and NEEDRESTART_MODE=l, whatever its config
says), else the processes whose /proc/<pid>/maps maps deleted code, each
named by its cgroup's service as the listening sockets are. A refused root
raises instead of reading clean.
chore(release): 4.44.0
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Failing after 20s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m23s
driver / lowest (pull_request) Successful in 37s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Failing after 2m36s
driver / publish (pull_request) Skipped
5517464e1f
fix(services-restart): an LXC container's processes are left out (NetOrk/netork#2750)
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m23s
driver / test (3.13) (pull_request) Successful in 1m22s
driver / lowest (pull_request) Successful in 44s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Failing after 3m0s
driver / publish (pull_request) Skipped
67ffee4e9e
On a Proxmox node the /proc scan sees every container's processes: an LXC
container updates itself, and its own systemd's units (lxc/<vmid>/ns/...
.service) would read as the host's services needing a restart. They are
left out like Docker's and Podman's: /lxc/<name>/ (Proxmox VE, cgroup v1)
and /lxc.payload.<name>/ (LXC 4 and later). The monitor, lxc.monitor/<name>,
runs the host's lxc-start and still counts.
refactor(services-restart): its shapes live in its own module, within the quality ratchet
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m26s
driver / test (3.12) (pull_request) Successful in 1m30s
driver / lowest (pull_request) Successful in 46s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m56s
driver / publish (pull_request) Skipped
494b9ed046
models.py had grown past its recorded size; ServicesRestartDict and
RestartProcessDict move to services_restart, exported from the package.
# Conflicts:
#	CHANGELOG.md
chore(release): 4.45.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 59s
driver / test (3.13) (pull_request) Successful in 1m16s
driver / test (3.12) (pull_request) Successful in 1m20s
driver / lowest (pull_request) Successful in 41s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 2m44s
driver / publish (pull_request) Skipped
a38f07513f
chore(release): 4.46.0
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m22s
driver / test (3.13) (pull_request) Successful in 1m17s
driver / lowest (pull_request) Successful in 55s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m58s
driver / publish (pull_request) Skipped
f8c456d784
christianmanivong added 1 commit 2026-11-26 18:51:18 +00:00
Merge remote-tracking branch 'origin/main' into feature/services-need-restart-lxc
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m20s
driver / lowest (pull_request) Successful in 42s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 2m42s
driver / publish (pull_request) Skipped
6c90373c80
christianmanivong merged commit 5985c87cc8 into main 2026-11-26 18:56:35 +00:00
christianmanivong deleted branch feature/services-need-restart-lxc 2026-11-26 18:56:35 +00:00
Sign in to join this conversation.