From 35c7a9eb9d2c6dc3c9b695f148319f53bf4b8fe7 Mon Sep 17 00:00:00 2001
From: Maksim Malchuk <maksim.malchuk@gmail.com>
Date: Sun, 3 Dec 2023 00:46:40 +0300
Subject: [PATCH] Fix wsrep sync status task while switched to TCP/IP

Followup on Id6eae798784126d4dd53adef15bdce6b47b4601f to fix an issue
when a client with provided port set tries to connect 'localhost', so
while we switch to TCP/IP we need to explicitly provide the host too.

Partial-Bug: #2024554
Change-Id: Ib08c159dadd69a1f44924d658f4afe1e794a18b0
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
---
 ansible/roles/mariadb/tasks/restart_services.yml     | 3 ++-
 releasenotes/notes/bug-2024554-6eb811364536f1e8.yaml | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/mariadb/tasks/restart_services.yml b/ansible/roles/mariadb/tasks/restart_services.yml
index dcc178ef3..869525c3b 100644
--- a/ansible/roles/mariadb/tasks/restart_services.yml
+++ b/ansible/roles/mariadb/tasks/restart_services.yml
@@ -31,7 +31,8 @@
   become: true
   command: >-
     {{ kolla_container_engine }} exec {{ mariadb_service.container_name }}
-    mysql -uroot -p{{ database_password }} -P {{ mariadb_port }}
+    mysql -uroot -p{{ database_password }}
+    -h {{ api_interface_address }} -P {{ mariadb_port }}
     --silent --skip-column-names
     -e 'SHOW STATUS LIKE "wsrep_local_state_comment"'
   changed_when: false
diff --git a/releasenotes/notes/bug-2024554-6eb811364536f1e8.yaml b/releasenotes/notes/bug-2024554-6eb811364536f1e8.yaml
index 1db1d5a16..19de8634b 100644
--- a/releasenotes/notes/bug-2024554-6eb811364536f1e8.yaml
+++ b/releasenotes/notes/bug-2024554-6eb811364536f1e8.yaml
@@ -2,6 +2,6 @@
 fixes:
   - |
     Fixes 2024554.
-    Adds mariadb_port to the wsrep sync status check.
+    Adds host and ``mariadb_port`` to the wsrep sync status check.
     This is so none standard ports can be used for mariadb deployments.
     `LP#2024554 <https://launchpad.net/bugs/2024554>`__
-- 
GitLab