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
This commit is contained in:
parent
884ab16968
commit
025110241e
|
@ -1,49 +1,34 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
RUN_DB_SYNC=${1:-""}
|
|
||||||
function run_db_sync() {
|
|
||||||
[ -n "$RUN_DB_SYNC" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
db_pass=$(os-apply-config --key db-password)
|
db_pass=$(os-apply-config --key db-password)
|
||||||
|
|
||||||
PATH=/usr/local/bin:$PATH
|
PATH=/usr/local/bin:$PATH
|
||||||
|
|
||||||
os-db-create keystone keystone $db_pass
|
os-db-create keystone keystone $db_pass
|
||||||
run_db_sync && keystone-manage db_sync
|
|
||||||
|
|
||||||
if which cinder-manage 1>/dev/null 2>&1; then
|
if which cinder-manage 1>/dev/null 2>&1; then
|
||||||
os-db-create cinder cinder $db_pass
|
os-db-create cinder cinder $db_pass
|
||||||
run_db_sync && cinder-manage db sync
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which ironic-dbsync 1>/dev/null 2>&1; then
|
if which ironic-dbsync 1>/dev/null 2>&1; then
|
||||||
os-db-create ironic ironic $db_pass
|
os-db-create ironic ironic $db_pass
|
||||||
run_db_sync && ironic-dbsync --config-file /etc/ironic/ironic.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which tuskar-dbsync 1>/dev/null 2>&1; then
|
if which tuskar-dbsync 1>/dev/null 2>&1; then
|
||||||
os-db-create tuskar tuskar $db_pass
|
os-db-create tuskar tuskar $db_pass
|
||||||
run_db_sync && tuskar-dbsync --config-file /etc/tuskar/tuskar.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if which ceilometer-dbsync 1>/dev/null 2>&1; then
|
if which ceilometer-dbsync 1>/dev/null 2>&1; then
|
||||||
os-db-create ceilometer ceilometer $db_pass
|
os-db-create ceilometer ceilometer $db_pass
|
||||||
run_db_sync && ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
os-db-create nova nova $db_pass
|
os-db-create nova nova $db_pass
|
||||||
run_db_sync && nova-manage db sync
|
|
||||||
|
|
||||||
os-db-create nova_bm nova $db_pass
|
os-db-create nova_bm nova $db_pass
|
||||||
run_db_sync && nova-baremetal-manage db sync
|
|
||||||
|
|
||||||
os-db-create glance glance $db_pass
|
os-db-create glance glance $db_pass
|
||||||
run_db_sync && glance-manage db_sync
|
|
||||||
|
|
||||||
os-db-create heat heat $db_pass
|
os-db-create heat heat $db_pass
|
||||||
run_db_sync && heat-manage db_sync
|
|
||||||
|
|
||||||
os-db-create ovs_neutron neutron $db_pass
|
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
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
ceilometer
|
ceilometer
|
||||||
iptables
|
iptables
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf
|
|
||||||
|
|
||||||
os-svc-enable -n ceilometer-api
|
os-svc-enable -n ceilometer-api
|
||||||
|
|
||||||
[ -d /mnt/state/var/lib/ceilometer ] || install -d -D -m 0770 -o ceilometer -g ceilometer /mnt/state/var/lib/ceilometer
|
[ -d /mnt/state/var/lib/ceilometer ] || install -d -D -m 0770 -o ceilometer -g ceilometer /mnt/state/var/lib/ceilometer
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
cinder
|
cinder
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
source-repositories
|
source-repositories
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
cinder-manage db sync
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
cinder-manage db sync
|
|
||||||
|
|
||||||
os-svc-enable -n cinder-api
|
os-svc-enable -n cinder-api
|
||||||
os-svc-enable -n cinder-scheduler
|
os-svc-enable -n cinder-scheduler
|
||||||
os-svc-restart -n cinder-api
|
os-svc-restart -n cinder-api
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
iptables
|
iptables
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
source-repositories
|
source-repositories
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
glance-manage db sync
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
glance-manage db_sync
|
|
||||||
|
|
||||||
os-svc-enable -n glance-api
|
os-svc-enable -n glance-api
|
||||||
os-svc-enable -n glance-reg
|
os-svc-enable -n glance-reg
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
heat
|
heat
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
heat-manage db_sync
|
||||||
|
fi
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
heat-manage db_sync
|
|
||||||
|
|
||||||
os-svc-enable -n heat-engine
|
os-svc-enable -n heat-engine
|
||||||
|
|
||||||
os-svc-restart -n heat-engine
|
os-svc-restart -n heat-engine
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
iptables
|
iptables
|
||||||
ironic
|
ironic
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
ironic-dbsync --config-file /etc/ironic/ironic.conf
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
ironic-dbsync --config-file /etc/ironic/ironic.conf
|
|
||||||
|
|
||||||
os-svc-enable -n ironic-api
|
os-svc-enable -n ironic-api
|
||||||
|
|
||||||
service ironic-api restart
|
service ironic-api restart
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
iptables
|
iptables
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
source-repositories
|
source-repositories
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
keystone-manage db_sync
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
keystone-manage db_sync
|
|
||||||
|
|
||||||
os-svc-enable -n keystone
|
os-svc-enable -n keystone
|
||||||
|
|
||||||
os-svc-restart -n keystone
|
os-svc-restart -n keystone
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
iptables
|
iptables
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
source-repositories
|
source-repositories
|
||||||
|
|
|
@ -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
|
|
@ -1,3 +1,4 @@
|
||||||
iptables
|
iptables
|
||||||
nova
|
nova
|
||||||
nova-novncproxy
|
nova-novncproxy
|
||||||
|
os-is-bootstrap-host
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
nova-manage db sync
|
||||||
|
fi
|
|
@ -9,8 +9,6 @@ chown -R nova:nova /var/run/openstack
|
||||||
mkdir -p /var/run/nova
|
mkdir -p /var/run/nova
|
||||||
chown -R nova:nova /var/run/nova
|
chown -R nova:nova /var/run/nova
|
||||||
|
|
||||||
nova-manage db sync
|
|
||||||
|
|
||||||
os-svc-enable -n nova-conductor
|
os-svc-enable -n nova-conductor
|
||||||
os-svc-enable -n nova-api
|
os-svc-enable -n nova-api
|
||||||
os-svc-enable -n nova-cert
|
os-svc-enable -n nova-cert
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
iptables
|
iptables
|
||||||
nova-compute
|
nova-compute
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
nova-baremetal-manage db sync
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
nova-baremetal-manage db sync
|
|
||||||
|
|
||||||
os-svc-enable -n nova-baremetal-deploy-helper
|
os-svc-enable -n nova-baremetal-deploy-helper
|
||||||
|
|
||||||
os-svc-restart -n nova-baremetal-deploy-helper
|
os-svc-restart -n nova-baremetal-deploy-helper
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
os-apply-config
|
os-apply-config
|
||||||
|
os-is-bootstrap-host
|
||||||
os-refresh-config
|
os-refresh-config
|
||||||
os-svc-install
|
os-svc-install
|
||||||
source-repositories
|
source-repositories
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
if os-is-bootstrap-host ; then
|
||||||
|
tuskar-dbsync --config-file /etc/tuskar/tuskar.conf
|
||||||
|
fi
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
tuskar-dbsync --config-file /etc/tuskar/tuskar.conf
|
|
||||||
|
|
||||||
os-svc-enable -n tuskar-api
|
os-svc-enable -n tuskar-api
|
||||||
|
|
||||||
service tuskar-api restart
|
service tuskar-api restart
|
||||||
|
|
Loading…
Reference in New Issue