summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-cinder/cinder-init
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2018-04-30 14:51:41 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-05-01 23:15:31 -0400
commitedb9fed9aca8452e54624d9da109cdd7cabcf30c (patch)
treed4e82ce24e800b24d08548a138b3df0488eda780 /meta-openstack/recipes-devtools/python/python-cinder/cinder-init
parentdb5a6a32fed0b97dcaa590120558c857f30c1bec (diff)
downloadmeta-cloud-services-edb9fed9aca8452e54624d9da109cdd7cabcf30c.tar.gz
python-cinder: uprev to latest stable/pike
Requires the introduction of python-oauth2client and python-google-api-python-client packages/recipes. As with other openstack component uprev's we move some of the initialization from the first run scripts to the cinder-init.service which is run on first boot. This allows for someone to disable the default configuration by not including the cinder-init package in their image. The initialization is done following the guide at: At this point we have cinder up and running, which we can verify using the "openstack volume service list" command. root@controller:~# openstack volume service list +------------------+----------------------+------+---------+-------+----------------------------+ | Binary | Host | Zone | Status | State | Updated At | +------------------+----------------------+------+---------+-------+----------------------------+ | cinder-backup | controller | nova | enabled | down | 2018-04-30T15:31:08.330770 | | cinder-volume | controller@nfsdriver | nova | enabled | down | 2018-04-30T15:31:10.477678 | | cinder-scheduler | controller | nova | enabled | down | 2018-04-30T15:31:10.653041 | +------------------+----------------------+------+---------+-------+----------------------------+ We will have to adjust the configuration for a compute node but at this point we are concentrating on the initial configuration for the controller image. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-cinder/cinder-init')
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder-init57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder-init b/meta-openstack/recipes-devtools/python/python-cinder/cinder-init
new file mode 100644
index 0000000..e1a5758
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder-init
@@ -0,0 +1,57 @@
1#!/bin/bash
2#
3# Basic cinder setup based on:
4# https://docs.openstack.org/cinder/pike/install/cinder-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%
11CINDER_USER=%CINDER_USER%
12CINDER_GROUP=%CINDER_GROUP%
13CONTROLLER_IP=%CONTROLLER_IP%
14ADMIN_USER=%ADMIN_USER%
15ADMIN_PASSWORD=%ADMIN_PASSWORD%
16ADMIN_ROLE=%ADMIN_ROLE%
17SYSCONFDIR=%SYSCONFDIR%
18
19sudo -u postgres psql -c "CREATE DATABASE \"cinder\"" 2> /dev/null
20sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"cinder\" TO ${DB_USER}" 2> /dev/null
21
22source ${SYSCONFDIR}/keystone/admin-openrc
23
24openstack user create --domain default --password ${ADMIN_PASSWORD} ${CINDER_USER}
25
26# Ensure the 'service' project exists
27openstack project show service > /dev/null 2>&1
28if [ $? -ne 0 ]; then
29 openstack project create service --domain default
30fi
31openstack role add --project service --user ${CINDER_USER} ${ADMIN_ROLE}
32
33# Create cinderv2 service and service endpoints
34openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
35openstack endpoint create --region RegionOne volumev2 public http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s
36openstack endpoint create --region RegionOne volumev2 internal http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s
37openstack endpoint create --region RegionOne volumev2 admin http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s
38
39# Create cinderv3 service and service endpoints
40openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
41openstack endpoint create --region RegionOne volumev3 public http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s
42openstack endpoint create --region RegionOne volumev3 internal http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s
43openstack endpoint create --region RegionOne volumev3 admin http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s
44
45sudo -u ${CINDER_USER} cinder-manage db sync
46
47# Enable cinder services now that they are configured
48systemctl enable cinder-api
49systemctl enable cinder-volume
50systemctl enable cinder-backup
51systemctl enable cinder-scheduler
52
53# Start our services
54systemctl start cinder-api
55systemctl start cinder-volume
56systemctl start cinder-backup
57systemctl start cinder-scheduler