From 865d041bc6101621182184057c516176f0a09e1d Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Tue, 15 Oct 2024 14:25:33 +0100 Subject: [PATCH] Fix Octavia service upgrade failure from 2023.1 There is a bug that upgrading Octavia from 2023.1 to 2023.2 or 2024.1 release fails because Octavia persistence database user is missing. Fixing by running persistence database creation tasks. This ensures creating Octavia persistence database user on service upgrade. Closes-Bug: #2065591 Change-Id: Ic01825fdb02bf64b620f8c318eea1e09497d37ba --- ansible/roles/octavia/tasks/upgrade.yml | 37 +++++++++++++++++++ ...avia-service-upgrade-9610e35cfdd512f6.yaml | 6 +++ 2 files changed, 43 insertions(+) create mode 100644 releasenotes/notes/fix-octavia-service-upgrade-9610e35cfdd512f6.yaml diff --git a/ansible/roles/octavia/tasks/upgrade.yml b/ansible/roles/octavia/tasks/upgrade.yml index 6ba9f99799..a6c6bb6b41 100644 --- a/ansible/roles/octavia/tasks/upgrade.yml +++ b/ansible/roles/octavia/tasks/upgrade.yml @@ -3,6 +3,43 @@ - import_tasks: check-containers.yml +# NOTE(mnasiadka): Run octavia persistence db tasks for upgrade +- name: Creating Octavia persistence database + become: true + kolla_toolbox: + container_engine: "{{ kolla_container_engine }}" + module_name: mysql_db + module_args: + login_host: "{{ database_address }}" + login_port: "{{ database_port }}" + login_user: "{{ octavia_persistence_database_shard_root_user }}" + login_password: "{{ database_password }}" + name: "{{ octavia_persistence_database_name }}" + run_once: True + delegate_to: "{{ groups['octavia-api'][0] }}" + when: + - not use_preconfigured_databases | bool + +- name: Creating Octavia persistence database user and setting permissions + become: true + kolla_toolbox: + container_engine: "{{ kolla_container_engine }}" + module_name: mysql_user + module_args: + login_host: "{{ database_address }}" + login_port: "{{ database_port }}" + login_user: "{{ octavia_persistence_database_shard_root_user }}" + login_password: "{{ database_password }}" + name: "{{ octavia_persistence_database_user }}" + password: "{{ octavia_persistence_database_password }}" + host: "%" + priv: "{{ octavia_persistence_database_name }}.*:ALL" + append_privs: "yes" + run_once: True + delegate_to: "{{ groups['octavia-api'][0] }}" + when: + - not use_preconfigured_databases | bool + - import_tasks: bootstrap_service.yml - name: Flush handlers diff --git a/releasenotes/notes/fix-octavia-service-upgrade-9610e35cfdd512f6.yaml b/releasenotes/notes/fix-octavia-service-upgrade-9610e35cfdd512f6.yaml new file mode 100644 index 0000000000..bbc6e306e6 --- /dev/null +++ b/releasenotes/notes/fix-octavia-service-upgrade-9610e35cfdd512f6.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes Octavia service upgrade issue where it can fail when Octavia + persistence database user is missing. + `LP#2065591 `__