neutron: rename db when upgrading a containerized undercloud
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. Also, we'll make sure mariadb is stopped before running Puppet steps, but only when we deploy a containerized undercloud and also when mariadb was actually running. The tasks are idempotent and tested. Change-Id: I009cd38f4d10bf3942c8f18f90c6a0fa50858219 Closes-Bug: #1753247
This commit is contained in:
parent
ccbe1949fd
commit
5cb155eb7c
|
@ -48,6 +48,10 @@ parameters:
|
||||||
type: string
|
type: string
|
||||||
description: Specifies the default CA cert to use if TLS is used for
|
description: Specifies the default CA cert to use if TLS is used for
|
||||||
services in the internal network.
|
services in the internal network.
|
||||||
|
MigrateLegacyNeutronDb:
|
||||||
|
type: boolean
|
||||||
|
description: Used to rename the undercloud database from neutron to ovs_neutron.
|
||||||
|
default: false
|
||||||
|
|
||||||
conditions:
|
conditions:
|
||||||
|
|
||||||
|
@ -233,6 +237,31 @@ outputs:
|
||||||
Log files from mysql containers can be found under
|
Log files from mysql containers can be found under
|
||||||
/var/log/containers/mysql.
|
/var/log/containers/mysql.
|
||||||
ignore_errors: true
|
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:
|
upgrade_tasks:
|
||||||
- name: Check if mysql service is deployed
|
- name: Check if mysql service is deployed
|
||||||
command: systemctl is-enabled --quiet mariadb
|
command: systemctl is-enabled --quiet mariadb
|
||||||
|
|
|
@ -69,3 +69,4 @@ parameter_defaults:
|
||||||
NeutronTypeDrivers: ['local','flat','vlan','gre','vxlan']
|
NeutronTypeDrivers: ['local','flat','vlan','gre','vxlan']
|
||||||
NeutronVniRanges: '10:100'
|
NeutronVniRanges: '10:100'
|
||||||
NeutronPortQuota: '-1'
|
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…
Reference in New Issue