fix(get_config): strip veth interfaces — Docker container churn causes false-positive config changes every poll
Docker creates a fresh veth pair with a new random name and ifindex for every container start/restart. ip addr show includes them, so get_config() reported a "config change" on nearly every poll of a Docker host even though nothing about the host's own configuration changed.
This commit is contained in:
@@ -697,13 +697,19 @@ class LinuxDriver(OSDriver):
|
||||
|
||||
``valid_lft`` / ``preferred_lft`` fields from DHCP leases are stripped
|
||||
so the output is stable across polls and does not produce false-positive
|
||||
config-change events in the config-backup feature.
|
||||
config-change events in the config-backup feature. ``veth*`` interfaces
|
||||
are stripped entirely — Docker creates/destroys them with a fresh index
|
||||
and random name on every container restart, which would otherwise flag
|
||||
a config change on nearly every poll of a Docker host.
|
||||
"""
|
||||
import re
|
||||
|
||||
running = self._send("ip addr show && ip route show")
|
||||
# Strip volatile DHCP lease timer fields — they decrement every poll
|
||||
running = re.sub(r"\s+valid_lft\s+\S+\s+preferred_lft\s+\S+", "", running)
|
||||
# Strip veth interface blocks (line + indented sub-lines) — ephemeral
|
||||
# Docker container network endpoints, not intentional host config
|
||||
running = re.sub(r"^\d+: veth\S*:.*\n(?:[ \t]+.*\n?)*", "", running, flags=re.MULTILINE)
|
||||
return {"running": running, "startup": "", "candidate": ""}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user