diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2018-04-30 14:51:41 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-05-01 23:15:31 -0400 |
| commit | edb9fed9aca8452e54624d9da109cdd7cabcf30c (patch) | |
| tree | d4e82ce24e800b24d08548a138b3df0488eda780 /meta-openstack/recipes-devtools/python/python-cinder/cinder-init | |
| parent | db5a6a32fed0b97dcaa590120558c857f30c1bec (diff) | |
| download | meta-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-init | 57 |
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() | ||
| 10 | DB_USER=%DB_USER% | ||
| 11 | CINDER_USER=%CINDER_USER% | ||
| 12 | CINDER_GROUP=%CINDER_GROUP% | ||
| 13 | CONTROLLER_IP=%CONTROLLER_IP% | ||
| 14 | ADMIN_USER=%ADMIN_USER% | ||
| 15 | ADMIN_PASSWORD=%ADMIN_PASSWORD% | ||
| 16 | ADMIN_ROLE=%ADMIN_ROLE% | ||
| 17 | SYSCONFDIR=%SYSCONFDIR% | ||
| 18 | |||
| 19 | sudo -u postgres psql -c "CREATE DATABASE \"cinder\"" 2> /dev/null | ||
| 20 | sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"cinder\" TO ${DB_USER}" 2> /dev/null | ||
| 21 | |||
| 22 | source ${SYSCONFDIR}/keystone/admin-openrc | ||
| 23 | |||
| 24 | openstack user create --domain default --password ${ADMIN_PASSWORD} ${CINDER_USER} | ||
| 25 | |||
| 26 | # Ensure the 'service' project exists | ||
| 27 | openstack project show service > /dev/null 2>&1 | ||
| 28 | if [ $? -ne 0 ]; then | ||
| 29 | openstack project create service --domain default | ||
| 30 | fi | ||
| 31 | openstack role add --project service --user ${CINDER_USER} ${ADMIN_ROLE} | ||
| 32 | |||
| 33 | # Create cinderv2 service and service endpoints | ||
| 34 | openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 | ||
| 35 | openstack endpoint create --region RegionOne volumev2 public http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s | ||
| 36 | openstack endpoint create --region RegionOne volumev2 internal http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s | ||
| 37 | openstack endpoint create --region RegionOne volumev2 admin http://${CONTROLLER_IP}:8776/v2/%\(project_id\)s | ||
| 38 | |||
| 39 | # Create cinderv3 service and service endpoints | ||
| 40 | openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3 | ||
| 41 | openstack endpoint create --region RegionOne volumev3 public http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s | ||
| 42 | openstack endpoint create --region RegionOne volumev3 internal http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s | ||
| 43 | openstack endpoint create --region RegionOne volumev3 admin http://${CONTROLLER_IP}:8776/v3/%\(project_id\)s | ||
| 44 | |||
| 45 | sudo -u ${CINDER_USER} cinder-manage db sync | ||
| 46 | |||
| 47 | # Enable cinder services now that they are configured | ||
| 48 | systemctl enable cinder-api | ||
| 49 | systemctl enable cinder-volume | ||
| 50 | systemctl enable cinder-backup | ||
| 51 | systemctl enable cinder-scheduler | ||
| 52 | |||
| 53 | # Start our services | ||
| 54 | systemctl start cinder-api | ||
| 55 | systemctl start cinder-volume | ||
| 56 | systemctl start cinder-backup | ||
| 57 | systemctl start cinder-scheduler | ||
