This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run migrations from only the bootstrap host
This ensures database migrations only happen on one node. It moves database migration from post-configure.d to configure.d within individual service elements and protects all 'db sync' call with an os-is-bootstrap-host check until we have a better story regarding leadership checks. Also removes all redundant 'db sync' calls from the boot-stack element (they were not actually being run there, anyway). Change-Id: Idf3c642614699cf3f79aefd7434b3eb4983df1ae Closes-bug: #1339047
- Loading branch information
1 parent
884ab16
commit 0251102
Showing
30 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,34 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
RUN_DB_SYNC=${1:-""} | ||
function run_db_sync() { | ||
[ -n "$RUN_DB_SYNC" ] | ||
} | ||
|
||
db_pass=$(os-apply-config --key db-password) | ||
|
||
PATH=/usr/local/bin:$PATH | ||
|
||
os-db-create keystone keystone $db_pass | ||
run_db_sync && keystone-manage db_sync | ||
|
||
if which cinder-manage 1>/dev/null 2>&1; then | ||
os-db-create cinder cinder $db_pass | ||
run_db_sync && cinder-manage db sync | ||
fi | ||
|
||
if which ironic-dbsync 1>/dev/null 2>&1; then | ||
os-db-create ironic ironic $db_pass | ||
run_db_sync && ironic-dbsync --config-file /etc/ironic/ironic.conf | ||
fi | ||
|
||
if which tuskar-dbsync 1>/dev/null 2>&1; then | ||
os-db-create tuskar tuskar $db_pass | ||
run_db_sync && tuskar-dbsync --config-file /etc/tuskar/tuskar.conf | ||
fi | ||
|
||
if which ceilometer-dbsync 1>/dev/null 2>&1; then | ||
os-db-create ceilometer ceilometer $db_pass | ||
run_db_sync && ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf | ||
fi | ||
|
||
os-db-create nova nova $db_pass | ||
run_db_sync && nova-manage db sync | ||
|
||
os-db-create nova_bm nova $db_pass | ||
run_db_sync && nova-baremetal-manage db sync | ||
|
||
os-db-create glance glance $db_pass | ||
run_db_sync && glance-manage db_sync | ||
|
||
os-db-create heat heat $db_pass | ||
run_db_sync && heat-manage db_sync | ||
|
||
os-db-create ovs_neutron neutron $db_pass | ||
neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ceilometer | ||
iptables | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install |
6 changes: 6 additions & 0 deletions
6
elements/ceilometer-api/os-refresh-config/configure.d/90-ceilometer-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/ceilometer-api/os-refresh-config/post-configure.d/69-ceilometer-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
cinder | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install | ||
source-repositories | ||
|
6 changes: 6 additions & 0 deletions
6
elements/cinder-api/os-refresh-config/configure.d/90-cinder-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
cinder-manage db sync | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/cinder-api/os-refresh-config/post-configure.d/73-cinder-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
iptables | ||
os-apply-config | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install | ||
source-repositories |
6 changes: 6 additions & 0 deletions
6
elements/glance/os-refresh-config/configure.d/90-glance-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
glance-manage db sync | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
glance-manage db_sync | ||
|
||
os-svc-enable -n glance-api | ||
os-svc-enable -n glance-reg | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
heat | ||
os-apply-config | ||
os-is-bootstrap-host |
6 changes: 6 additions & 0 deletions
6
elements/heat-engine/os-refresh-config/configure.d/90-heat-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
heat-manage db_sync | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
|
||
set -e | ||
|
||
heat-manage db_sync | ||
|
||
os-svc-enable -n heat-engine | ||
|
||
os-svc-restart -n heat-engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
iptables | ||
ironic | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install |
6 changes: 6 additions & 0 deletions
6
elements/ironic-api/os-refresh-config/configure.d/90-ironic-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
ironic-dbsync --config-file /etc/ironic/ironic.conf | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/ironic-api/os-refresh-config/post-configure.d/68-ironic-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
ironic-dbsync --config-file /etc/ironic/ironic.conf | ||
|
||
os-svc-enable -n ironic-api | ||
|
||
service ironic-api restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
iptables | ||
os-apply-config | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install | ||
source-repositories |
6 changes: 6 additions & 0 deletions
6
elements/keystone/os-refresh-config/configure.d/90-keystone-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
keystone-manage db_sync | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/keystone/os-refresh-config/post-configure.d/70-keystone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
keystone-manage db_sync | ||
|
||
os-svc-enable -n keystone | ||
|
||
os-svc-restart -n keystone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
iptables | ||
os-apply-config | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install | ||
source-repositories |
6 changes: 6 additions & 0 deletions
6
elements/neutron/os-refresh-config/configure.d/90-neutron-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
iptables | ||
nova | ||
nova-novncproxy | ||
os-is-bootstrap-host |
6 changes: 6 additions & 0 deletions
6
elements/nova-api/os-refresh-config/configure.d/90-nova-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
nova-manage db sync | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
iptables | ||
nova-compute | ||
os-apply-config | ||
os-is-bootstrap-host | ||
os-refresh-config |
6 changes: 6 additions & 0 deletions
6
elements/nova-baremetal/os-refresh-config/configure.d/90-nova-baremetal-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
nova-baremetal-manage db sync | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/nova-baremetal/os-refresh-config/post-configure.d/80-nova-baremetal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
nova-baremetal-manage db sync | ||
|
||
os-svc-enable -n nova-baremetal-deploy-helper | ||
|
||
os-svc-restart -n nova-baremetal-deploy-helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
os-apply-config | ||
os-is-bootstrap-host | ||
os-refresh-config | ||
os-svc-install | ||
source-repositories |
6 changes: 6 additions & 0 deletions
6
elements/tuskar/os-refresh-config/configure.d/90-tuskar-db-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
if os-is-bootstrap-host ; then | ||
tuskar-dbsync --config-file /etc/tuskar/tuskar.conf | ||
fi |
2 changes: 0 additions & 2 deletions
2
elements/tuskar/os-refresh-config/post-configure.d/100-tuskar-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
tuskar-dbsync --config-file /etc/tuskar/tuskar.conf | ||
|
||
os-svc-enable -n tuskar-api | ||
|
||
service tuskar-api restart |