diff options
author | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2014-11-26 17:34:14 +0000 |
---|---|---|
committer | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2015-01-22 12:46:25 +0000 |
commit | 584d66db1810eb640b9afd6e3f952fffdde88aa7 (patch) | |
tree | d5386a4aa37bc5f81332fdd67f046292e834b446 /openstack/usr | |
parent | 2d72c26366ca77d7a1a49e928a14c43b11706a81 (diff) | |
download | definitions-584d66db1810eb640b9afd6e3f952fffdde88aa7.tar.gz |
Add cinder services
This commit add:
- Cinder services
- Cinder setup script and service
- Cinder integration script (config file)
- Cinder files in the manifest
- Cinder string on the cluster
- Move nova region to regionOne (default value) rather than LON
Diffstat (limited to 'openstack/usr')
-rw-r--r-- | openstack/usr/share/openstack/openstack-cinder-setup | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/openstack/usr/share/openstack/openstack-cinder-setup b/openstack/usr/share/openstack/openstack-cinder-setup new file mode 100644 index 00000000..8358e641 --- /dev/null +++ b/openstack/usr/share/openstack/openstack-cinder-setup @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (C) 2014 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -e + +# Create required system users and groups + +getent group cinder >/dev/null || groupadd -r --gid 165 cinder +getent passwd cinder >/dev/null || \ + useradd --uid 165 -r -g cinder -d /var/lib/cinder -s /sbin/nologin \ + -c "OpenStack Cinder Daemons" cinder + +# Create the keystone user and services + +export OS_SERVICE_TOKEN=##KEYSTONE_TEMPORARY_ADMIN_TOKEN## +export OS_SERVICE_ENDPOINT='http://localhost:35357/v2.0' + +keystone user-create --name ##CINDER_USER## --pass ##CINDER_PASSWORD## +keystone user-role-add --tenant service --user ##CINDER_USER## --role admin + +# Register the Block Storage service with the Identity service so other OpenStack services +# can locate it +keystone service-create --name ##CINDER_USER## --type volume --description "OpenStack Block Storage" +keystone endpoint-create --service-id $(keystone service-list | awk '/ volume / {print $2}') \ + --publicurl ##CINDER_PUBLIC_URL## \ + --internalurl ##CINDER_INTERNAL_URL## \ + --adminurl ##CINDER_ADMIN_URL## + +# Register a service and endpoint for version 2 of the Block Storage service API +keystone service-create --name ##CINDER_USER_V2## \ + --type volumev2 --description "OpenStack Block Storage" +keystone endpoint-create --service-id $(keystone service-list | awk '/ volumev2 / {print $2}') \ + --publicurl ##CINDER_PUBLIC_URL_V2## \ + --internalurl ##CINDER_INTERNAL_URL_V2## \ + --adminurl ##CINDER_ADMIN_URL_V2## + +# Create run directory for cinder +if [ ! -d /var/run/cinder ]; then + mkdir -p /var/run/cinder + chown -R cinder:cinder /var/run/cinder +fi + +# Create the lock directory for cinder +if [ ! -d /var/lock/cinder ]; then + mkdir -p /var/lock/cinder + chown -R cinder:cinder /var/lock/cinder +fi + +# Setup the cinder database +if [ ! -e /var/lib/cinder/cinder.sqlite ]; then + chown -R cinder:cinder /var/lib/cinder + sudo -u cinder cinder-manage db sync +fi + +# Remove the one-shot setup service +rm /etc/systemd/system/multi-user.target.wants/openstack-cinder-setup.service + +# Start cinder services +systemctl start openstack-cinder-api +systemctl start openstack-cinder-scheduler +systemctl start openstack-cinder-volume +systemctl start openstack-cinder-backup + +# Create the links to run nova services when system start next times. +ln -s "/etc/systemd/system/openstack-cinder-api.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service" + +ln -s "/etc/systemd/system/openstack-cinder-scheduler.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service" + +ln -s "/etc/systemd/system/openstack-cinder-volume.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-cinder-volume.service" + +ln -s "/etc/systemd/system/openstack-cinder-backup.service" \ + "/etc/systemd/system/multi-user.target.wants/openstack-cinder-backup.service" + +exit 0 |