summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-nova/nova-init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-nova/nova-init')
-rw-r--r--meta-openstack/recipes-devtools/python/python-nova/nova-init75
1 files changed, 75 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova-init b/meta-openstack/recipes-devtools/python/python-nova/nova-init
new file mode 100644
index 0000000..5faa7d6
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-nova/nova-init
@@ -0,0 +1,75 @@
1#!/bin/bash
2#
3# Basic nova setup based on:
4# https://docs.openstack.org/nova/pike/install/controller-install-ubuntu.html
5#
6# Prerequisites: keystone must be available and bootstrapped
7#
8
9# Substitutions setup at do_intall()
10DB_USER=%DB_USER%
11NOVA_USER=%NOVA_USER%
12NOVA_GROUP=%NOVA_GROUP%
13CONTROLLER_IP=%CONTROLLER_IP%
14ADMIN_USER=%ADMIN_USER%
15ADMIN_PASSWORD=%ADMIN_PASSWORD%
16ADMIN_ROLE=%ADMIN_ROLE%
17SYSCONFDIR=%SYSCONFDIR%
18PLACEMENT_USER=%PLACEMENT_USER%
19
20# sudo -u postgres createdb nova
21# sleep 2
22# nova-manage db sync
23
24# Create the neutron DB and grant the necessary permissions
25sudo -u postgres psql -c "CREATE DATABASE \"nova-api\"" 2> /dev/null
26sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"nova-api\" TO ${DB_USER}" 2> /dev/null
27
28sudo -u postgres psql -c "CREATE DATABASE nova" 2> /dev/null
29sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE nova TO ${DB_USER}" 2> /dev/null
30
31sudo -u postgres psql -c "CREATE DATABASE \"nova-cell0\"" 2> /dev/null
32sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"nova-cell0\" TO ${DB_USER}" 2> /dev/null
33
34source ${SYSCONFDIR}/keystone/admin-openrc
35
36openstack user create --domain default --password ${ADMIN_PASSWORD} ${NOVA_USER}
37
38# Ensure the 'service' project exists
39openstack project show service > /dev/null 2>&1
40if [ $? -ne 0 ]; then
41 openstack project create service --domain default
42fi
43openstack role add --project service --user ${NOVA_USER} ${ADMIN_ROLE}
44
45# Create nova service and service endpoints
46openstack service create --name nova --description "OpenStack Compute" compute
47openstack endpoint create --region RegionOne compute public http://${CONTROLLER_IP}:8774
48openstack endpoint create --region RegionOne compute internal http://${CONTROLLER_IP}:8774
49openstack endpoint create --region RegionOne compute admin http://${CONTROLLER_IP}:8774
50
51# Create placement service, role, and endpoints.
52openstack user create --domain default --password ${ADMIN_PASSWORD} ${PLACEMENT_USER}
53openstack role add --project service --user ${PLACEMENT_USER} ${ADMIN_ROLE}
54openstack service create --name placement --description "Placement API" placement
55openstack endpoint create --region RegionOne placement public http://${CONTROLLER_IP}:8778
56openstack endpoint create --region RegionOne placement internal http://${CONTROLLER_IP}:8778
57openstack endpoint create --region RegionOne placement admin http://${CONTROLLER_IP}:8778
58
59sudo -u ${NOVA_USER} nova-manage api_db sync
60sudo -u ${NOVA_USER} nova-manage cell_v2 map_cell0
61sudo -u ${NOVA_USER} nova-manage cell_v2 create_cell --name=cell1 --verbose
62sudo -u ${NOVA_USER} nova-manage db sync
63
64# Enable and start the nova services
65systemctl enable nova-api
66systemctl enable nova-consoleauth
67systemctl enable nova-scheduler
68systemctl enable nova-conductor
69systemctl enable nova-novncproxy
70
71systemctl start nova-api
72systemctl start nova-consoleauth
73systemctl start nova-scheduler
74systemctl start nova-conductor
75systemctl start nova-novncproxy