From 8841738416c86e4db14aeb9adcfabb98125016a3 Mon Sep 17 00:00:00 2001 From: Mihai Prica Date: Thu, 4 Jul 2013 18:25:27 +0300 Subject: nova, glance, keystone, quantum: Make sure postgres is running To initialize the databases the openstack components require that the postgresql server is running. Because there is no guarantee to the order in which postinstalls are run, the postinstalls first check to see if postgresql is running, and start it if it's not. Signed-off-by: Mihai Prica --- meta-openstack/recipes-devtools/python/python-glance_2013.1.bb | 2 +- meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb | 8 ++++++++ meta-openstack/recipes-devtools/python/python-nova_2013.1.bb | 8 ++++++++ .../recipes-devtools/python/python-quantum_2013.1.2.bb | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb b/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb index a64ac9e..72d5662 100644 --- a/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb @@ -62,7 +62,7 @@ pkg_postinst_${SRCNAME} () { if ! pidof postmaster > /dev/null; then sudo -u postgres initdb -D /etc/postgresql/ /etc/init.d/postgresql start - sleep 0.5 + sleep 0.2 sudo -u postgres psql -c "CREATE ROLE admin WITH SUPERUSER LOGIN PASSWORD 'admin'" fi diff --git a/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb b/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb index ba63f98..fc4b3a0 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_2013.1.bb @@ -52,6 +52,14 @@ pkg_postinst_${SRCNAME} () { exit 1 fi + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + sudo -u postgres initdb -D /etc/postgresql/ + /etc/init.d/postgresql start + sleep 0.2 + sudo -u postgres psql -c "CREATE ROLE admin WITH SUPERUSER LOGIN PASSWORD 'admin'" + fi + sudo -u postgres createdb keystone keystone-manage db_sync keystone-manage pki_setup diff --git a/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb b/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb index dbe4d4f..0c59c2d 100644 --- a/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-nova_2013.1.bb @@ -76,6 +76,14 @@ pkg_postinst_${SRCNAME}-controller () { exit 1 fi + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + sudo -u postgres initdb -D /etc/postgresql/ + /etc/init.d/postgresql start + sleep 0.2 + sudo -u postgres psql -c "CREATE ROLE admin WITH SUPERUSER LOGIN PASSWORD 'admin'" + fi + sudo -u postgres createdb nova nova-manage db sync } diff --git a/meta-openstack/recipes-devtools/python/python-quantum_2013.1.2.bb b/meta-openstack/recipes-devtools/python/python-quantum_2013.1.2.bb index 56eaaf0..dfbe0dc 100644 --- a/meta-openstack/recipes-devtools/python/python-quantum_2013.1.2.bb +++ b/meta-openstack/recipes-devtools/python/python-quantum_2013.1.2.bb @@ -57,7 +57,16 @@ pkg_postinst_${SRCNAME} () { exit 1 fi + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + sudo -u postgres initdb -D /etc/postgresql/ + /etc/init.d/postgresql start + sleep 0.2 + sudo -u postgres psql -c "CREATE ROLE admin WITH SUPERUSER LOGIN PASSWORD 'admin'" + fi + sudo -u postgres createdb quantum + } PACKAGES += " \ -- cgit v1.2.3-54-g00ecf