Merge "neutron: rename db when upgrading a containerized undercloud"

changes/87/547787/4
Zuul 5 years ago committed by Gerrit Code Review
commit a197218d60
  1. 29
      docker/services/database/mysql.yaml
  2. 1
      environments/undercloud.yaml
  3. 7
      releasenotes/notes/neutron_db_rename-bbfbce1c58cadc84.yaml

@ -48,6 +48,10 @@ parameters:
type: string
description: Specifies the default CA cert to use if TLS is used for
services in the internal network.
MigrateLegacyNeutronDb:
type: boolean
description: Used to rename the undercloud database from neutron to ovs_neutron.
default: false
conditions:
@ -233,6 +237,31 @@ outputs:
Log files from mysql containers can be found under
/var/log/containers/mysql.
ignore_errors: true
# https://bugs.launchpad.net/tripleo/+bug/1753247
- name: Rename old neutron database to ovs_neutron
shell: >
if [ -d /var/lib/mysql/neutron ] ; then
mysql -e "CREATE DATABASE IF NOT EXISTS \`ovs_neutron\`;"
for table in `mysql -B -N -e "SHOW TABLES;" neutron`
do
mysql -e "RENAME TABLE \`neutron\`.\`$table\` to \`ovs_neutron\`.\`$table\`"
done
mysql -e "DROP DATABASE \`neutron\`;"
fi
become: true
when: {get_param: MigrateLegacyNeutronDb}
register: neutron_db_migration
- name: Check if mysql service is deployed
command: systemctl is-enabled --quiet mariadb
ignore_errors: True
register: mariadb_enabled
when: {get_param: MigrateLegacyNeutronDb}
- name: Stop and disable mysql service when undercloud is containerized
when:
- {get_param: MigrateLegacyNeutronDb}
- mariadb_enabled.rc == 0
- neutron_db_migration.rc == 0
service: name=mariadb state=stopped enabled=no
upgrade_tasks:
- name: Check if mysql service is deployed
command: systemctl is-enabled --quiet mariadb

@ -70,3 +70,4 @@ parameter_defaults:
NeutronTypeDrivers: ['local','flat','vlan','gre','vxlan']
NeutronVniRanges: '10:100'
NeutronPortQuota: '-1'
MigrateLegacyNeutronDb: true

@ -0,0 +1,7 @@
---
upgrade:
- |
When the undercloud was not containerized, the neutron database name was called neutron.
When we upgrade to a containerized undercloud, the database name is called ovs_neutron.
We introduced MigrateLegacyNeutronDb (false by default in the service but true when
the undercloud is containerized) that will rename the database during host_prep_tasks.
Loading…
Cancel
Save