diff options
author | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2014-12-17 18:07:16 +0000 |
---|---|---|
committer | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2015-01-22 12:46:28 +0000 |
commit | ad74d5116f2ef9473466270845f840f6a8f1a1a0 (patch) | |
tree | c029cae8ee648c269bf93bac40fc0419c3e6c346 /openstack/usr/share/openstack/openstack-neutron-setup | |
parent | b18f85176ffefafbe91b1ac0c0f7141bb7a59dea (diff) | |
download | definitions-ad74d5116f2ef9473466270845f840f6a8f1a1a0.tar.gz |
Configure neutron to use postgres instead of sqlite
Sqlite does not support some ALTER TABLE required on neutron-db-manage
upgrade. Therefore sqlite is not a valid database to use for neutron.
NOTE: juno requires to "upgrade" the database from icehouse because
"stamp" the database directly to juno does not create all the
tables required for using ml2 plugin
Diffstat (limited to 'openstack/usr/share/openstack/openstack-neutron-setup')
-rw-r--r-- | openstack/usr/share/openstack/openstack-neutron-setup | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/openstack/usr/share/openstack/openstack-neutron-setup b/openstack/usr/share/openstack/openstack-neutron-setup index 9955e9c6..94b0791c 100644 --- a/openstack/usr/share/openstack/openstack-neutron-setup +++ b/openstack/usr/share/openstack/openstack-neutron-setup @@ -24,8 +24,9 @@ getent passwd neutron >/dev/null || \ useradd --uid 166 -r -g neutron -d /var/lib/neutron -s /sbin/nologin \ -c "OpenStack Neutron Daemons" neutron -# Create the keystone user and services +chown -R neutron:neutron /var/lib/neutron +# Create the keystone user and services export OS_SERVICE_TOKEN=##KEYSTONE_TEMPORARY_ADMIN_TOKEN## export OS_SERVICE_ENDPOINT='http://localhost:35357/v2.0' @@ -55,25 +56,39 @@ if [ ! -d /var/log/neutron ]; then fi # Setup the neutron database -if [ ! -e /var/lib/neutron/neutron.sqlite ]; then - chown -R neutron:neutron /var/lib/neutron - # Stamp the database with the version of neutron we are using. This is - # needed before we can run any neutron services. - sudo -u neutron neutron-db-manage --config-file /etc/neutron/neutron.conf \ - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \ - stamp --sql juno +if ! sudo -u postgres psql -lqt | grep -q neutron; then + # Create postgresSQL user + sudo -u postgres createuser \ + --pwprompt --encrypted \ + --no-adduser --no-createdb \ + --no-password \ + ##NEUTRON_DB_USER## + sudo -u postgres createdb \ + --owner=##NEUTRON_DB_USER## \ + neutron + # Stamp neutron database with the latest stamped version available, + # in this case "icehouse" + sudo -u neutron neutron-db-manage \ + --config-file /etc/neutron/neutron.conf \ + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \ + stamp icehouse + # Upgrade database to "juno" + sudo -u neutron neutron-db-manage \ + --config-file /etc/neutron/neutron.conf \ + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \ + upgrade juno fi # Remove the one-shot setup service rm /etc/systemd/system/multi-user.target.wants/openstack-neutron-setup.service # Start neutron services +systemctl start openstack-neutron-server systemctl start openstack-neutron-metadata-agent systemctl start openstack-neutron-plugin-openvswitch-agent systemctl start openstack-neutron-ovs-cleanup systemctl start openstack-neutron-dhcp-agent systemctl start openstack-neutron-l3-agent -systemctl start openstack-neutron-server # Create the links to run neutron services when system start next times. ln -s "/etc/systemd/system/openstack-neutron-server.service" \ |