Browse Source

migration: Remove crudini when migrating tunnels

It turned out there doesn't need to be crudini tool present on the node
running the command. This patch fetches the Neutron conf file instead
and performs an ini lookup over it in order to get the DB connection
string.

Change-Id: Iaf79b8512a920e9f667bd6881d50e8852595fa71
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
changes/26/782826/1
Jakub Libosvar 3 months ago
parent
commit
94bea77fd7
2 changed files with 11 additions and 3 deletions
  1. +1
    -0
      tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers/defaults/main.yml
  2. +10
    -3
      tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers/tasks/main.yml

+ 1
- 0
tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers/defaults/main.yml View File

@ -1,2 +1,3 @@
---
neutron_conf_path: /var/lib/config-data/puppet-generated/neutron/etc/neutron/neutron.conf
neutron_conf_tempfile: /tmp/neutron.conf

+ 10
- 3
tools/ovn_migration/tripleo_environment/playbooks/roles/prepare-controllers/tasks/main.yml View File

@ -1,8 +1,15 @@
---
- name: Fetch neutron configuration
fetch:
src: "{{ neutron_conf_path }}"
dest: "{{ neutron_conf_tempfile }}"
flat: yes
when: ovn_central is defined
- name: Get DB connection string
command: crudini --get {{ neutron_conf_path }} database connection
set_fact:
db_connection_string: "{{ lookup('ini', 'connection section=database file={{ neutron_conf_tempfile }}') }}"
when: ovn_central is defined
register: mysql_url
# The shell below is not readable well. The code spawns a sqlalchemy engine
# and connects to the Neutron database to run following SQL command:
@ -16,5 +23,5 @@
# conn.execute("SQL COMMAND")
#
- name: Change vxlan networks to Geneve
shell: podman exec -it neutron_api python3 -c $'from sqlalchemy import create_engine\nengine = create_engine("{{ mysql_url.stdout }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
shell: podman exec -it neutron_api python3 -c $'from sqlalchemy import create_engine\nengine = create_engine("{{ db_connection_string }}")\nwith engine.connect() as conn:\n\tconn.execute("update networksegments set networksegments.network_type=\'geneve\' where networksegments.network_type=\'vxlan\';")'
when: ovn_central is defined

Loading…
Cancel
Save