From 4443596e298df53b23b7d81d703479aff186ff4f Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Thu, 24 Jun 2021 10:14:03 +0200 Subject: [PATCH] Enable lo interface in the amphora-haproxy netns Configure the lo interface in the amphora-haproxy namespace. It fixes issues with the synchronization of haproxy peer/stick tables when updating a load balancer configuration. Story 2009005 Task 42682 Change-Id: I15997acaf12258ec483286dad676efdea8963611 --- octavia/amphorae/backends/agent/api_server/osutils.py | 2 +- .../agent/api_server/templates/amphora-netns.systemd.j2 | 4 ++++ .../fix-lo-interface-amphora-netns-90fb9934026e1485.yaml | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-lo-interface-amphora-netns-90fb9934026e1485.yaml diff --git a/octavia/amphorae/backends/agent/api_server/osutils.py b/octavia/amphorae/backends/agent/api_server/osutils.py index c60a973a19..27a72d45f9 100644 --- a/octavia/amphorae/backends/agent/api_server/osutils.py +++ b/octavia/amphorae/backends/agent/api_server/osutils.py @@ -390,7 +390,7 @@ class RH(BaseOS): if not network_dir: network_dir = self.get_network_path() if not ignore: - ignore = shutil.ignore_patterns('ifcfg-eth0*', 'ifcfg-lo*') + ignore = shutil.ignore_patterns('ifcfg-eth0*') super().create_netns_dir( network_dir, netns_network_dir, ignore) diff --git a/octavia/amphorae/backends/agent/api_server/templates/amphora-netns.systemd.j2 b/octavia/amphorae/backends/agent/api_server/templates/amphora-netns.systemd.j2 index 552993df85..ca5dafccf1 100644 --- a/octavia/amphorae/backends/agent/api_server/templates/amphora-netns.systemd.j2 +++ b/octavia/amphorae/backends/agent/api_server/templates/amphora-netns.systemd.j2 @@ -26,7 +26,11 @@ ExecStart=-/bin/sh -c '/usr/bin/sort -k 1 /var/lib/octavia/plugged_interfaces > ExecStart=-/bin/sh -c '/sbin/ip link | awk \'{getline n; print $0,n}\' | awk \'{sub(":","",$2)} { for(i=1;i<=NF;i++) if ($i == "link/ether") {print $(i+1) " " $2} }\' | sort -k 1 | join -j 1 - /var/lib/octavia/plugged_interfaces.sorted | awk \'{system("ip link set "$2" netns {{ amphora_nsname }} name "$3"")}\'' # Bring up all of the namespace interfaces {%- if HasIFUPAll %} +# Ubuntu seems to not correctly set up the lo iface when calling ifup -a +# Disable it first, before setting it up. +ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifdown lo ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifup -a {%- else %} +ExecStart=-/sbin/ip netns exec {{ amphora_nsname }} ifup lo ExecStart=-/bin/awk '{system("/sbin/ip netns exec {{ amphora_nsname }} ifup " $2)}' /var/lib/octavia/plugged_interfaces {%- endif %} diff --git a/releasenotes/notes/fix-lo-interface-amphora-netns-90fb9934026e1485.yaml b/releasenotes/notes/fix-lo-interface-amphora-netns-90fb9934026e1485.yaml new file mode 100644 index 0000000000..e0a2971409 --- /dev/null +++ b/releasenotes/notes/fix-lo-interface-amphora-netns-90fb9934026e1485.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed an issue with the ``lo`` interface in the ``amphora-haproxy`` network + namespace. The ``lo`` interface was down and prevented haproxy to + communicate with other haproxy processes (for persistent stick tables) on + configuration change. It delayed old haproxy worker cleanup and increased + the memory consumption usage after reloading the configuration.