From 83cda3c191213e23634acfdefd7d31ad9ae09132 Mon Sep 17 00:00:00 2001 From: caleb Date: Wed, 3 Jul 2024 10:35:37 -0400 Subject: [PATCH] setup HA middleware connection on service restart --- .../middlewared/plugins/failover_/internal_interface.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/middlewared/middlewared/plugins/failover_/internal_interface.py b/src/middlewared/middlewared/plugins/failover_/internal_interface.py index 69e7866250566..da8bee4899dfd 100644 --- a/src/middlewared/middlewared/plugins/failover_/internal_interface.py +++ b/src/middlewared/middlewared/plugins/failover_/internal_interface.py @@ -95,3 +95,12 @@ def sync(self, iface, internal_ip): async def post_sync(self, internal_ip): if self.http_site is None: self.http_site = await self.middleware.start_tcp_site(internal_ip) + + +async def setup(middleware): + # on HA systems, we bind ourselves on 127.0.0.1:6000, however + # often times developers/CI/CD do `systemctl restart middlewared` + # which will tear down the local listening socket so we need to + # be sure and set it up everytime middleware starts. This is a + # NO-OP otherwise. + await middleware.call('failover.internal_interface.pre_sync')