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 | |
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')
7 files changed, 159 insertions, 0 deletions
diff --git a/openstack/etc/systemd/system/openstack-cinder-api.service b/openstack/etc/systemd/system/openstack-cinder-api.service new file mode 100644 index 00000000..4cd598fb --- /dev/null +++ b/openstack/etc/systemd/system/openstack-cinder-api.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Volume Service (code-named Cinder) API server +After=syslog.target network.target + +[Service] +Type=simple +User=cinder +ExecStart=/usr/bin/cinder-api --config-file /etc/cinder/cinder.conf + +[Install] +WantedBy=multi-user.target diff --git a/openstack/etc/systemd/system/openstack-cinder-backup.service b/openstack/etc/systemd/system/openstack-cinder-backup.service new file mode 100644 index 00000000..fef6302e --- /dev/null +++ b/openstack/etc/systemd/system/openstack-cinder-backup.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Cinder backup server +After=syslog.target network.target + +[Service] +Type=simple +User=cinder +ExecStart=/usr/bin/cinder-backup --config-file /etc/cinder/cinder.conf + +[Install] +WantedBy=multi-user.target diff --git a/openstack/etc/systemd/system/openstack-cinder-scheduler.service b/openstack/etc/systemd/system/openstack-cinder-scheduler.service new file mode 100644 index 00000000..977dda9d --- /dev/null +++ b/openstack/etc/systemd/system/openstack-cinder-scheduler.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Cinder scheduler server +After=syslog.target network.target + +[Service] +Type=simple +User=cinder +ExecStart=/usr/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf + +[Install] +WantedBy=multi-user.target diff --git a/openstack/etc/systemd/system/openstack-cinder-setup.service b/openstack/etc/systemd/system/openstack-cinder-setup.service new file mode 100644 index 00000000..085bf2a8 --- /dev/null +++ b/openstack/etc/systemd/system/openstack-cinder-setup.service @@ -0,0 +1,12 @@ +[Unit] +Description=Run openstack-cinder-setup (once) +Requires=local-fs.target +After=local-fs.target openstack-keystone-setup.service + +[Service] +Type=oneshot +ExecStart=/usr/share/openstack/openstack-cinder-setup +Restart=no + +[Install] +WantedBy=multi-user.target diff --git a/openstack/etc/systemd/system/openstack-cinder-volume.service b/openstack/etc/systemd/system/openstack-cinder-volume.service new file mode 100644 index 00000000..ccfc2a2a --- /dev/null +++ b/openstack/etc/systemd/system/openstack-cinder-volume.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenStack Cinder volume server +After=syslog.target network.target + +[Service] +Type=simple +User=cinder +ExecStart=/usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf + +[Install] +WantedBy=multi-user.target diff --git a/openstack/manifest b/openstack/manifest index 80e16187..2885f850 100644 --- a/openstack/manifest +++ b/openstack/manifest @@ -60,3 +60,15 @@ 0100644 0 0 /etc/systemd/system/openstack-rabbitmq-server.service 0100755 0 0 /usr/share/openstack/openstack-rabbitmq-setup 0040755 0 0 /var/lib/rabbitmq +0040755 0 0 /var/lib/cinder +0040755 0 0 /etc/cinder +0100644 0 0 /etc/cinder/rootwrap.conf +0100644 0 0 /etc/cinder/nova.conf +0100644 0 0 /etc/cinder/nova-compute.conf +0100644 0 0 /etc/cinder/policy.json +0100755 0 0 /usr/share/openstack/openstack-cinder-setup +0100644 0 0 /etc/systemd/system/openstack-cinder-setup.service +0100644 0 0 /etc/systemd/system/openstack-cinder-api.service +0100644 0 0 /etc/systemd/system/openstack-cinder-scheduler.service +0100644 0 0 /etc/systemd/system/openstack-cinder-volume.service +0100644 0 0 /etc/systemd/system/openstack-cinder-backup.service 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 |