summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2014-11-26 17:34:14 +0000
committerRichard Ipsum <richardipsum@fastmail.co.uk>2014-11-27 18:12:15 +0000
commite7bcbd54b0c083faefa6cc21a5e96e2dcd7228a9 (patch)
tree03c4699721d0acb8ce5001eebff90e292fbfd193
parent013743c82c7cbd19fe1be92236e12ce5a7d1880b (diff)
downloaddefinitions-e7bcbd54b0c083faefa6cc21a5e96e2dcd7228a9.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
-rw-r--r--clusters/openstack-cluster.morph11
-rw-r--r--openstack-cinder.configure53
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-api.service11
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-backup.service11
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-scheduler.service11
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-setup.service12
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-volume.service11
-rw-r--r--openstack/manifest12
-rw-r--r--openstack/usr/share/openstack/openstack-cinder-setup91
-rw-r--r--systems/openstack-server.morph1
10 files changed, 223 insertions, 1 deletions
diff --git a/clusters/openstack-cluster.morph b/clusters/openstack-cluster.morph
index 0d8a13b0..935aaa84 100644
--- a/clusters/openstack-cluster.morph
+++ b/clusters/openstack-cluster.morph
@@ -34,4 +34,13 @@ systems:
NOVA_INTERNAL_URL: \"http:\/\/localhost:8774\/v2\/\%\(tenant_id\)s\"
NOVA_ADMIN_URL: \"http:\/\/localhost:8774\/v2\/\%\(tenant_id\)s\"
NOVA_NOVNCPROXY_BASE_URL: http:\/\/localhost:6080\/vnc_auto.html
- NOVA_REGION: LON
+ NOVA_REGION: regionOne
+ CINDER_USER: cinder
+ CINDER_PASSWORD: veryinsecure
+ CINDER_PUBLIC_URL: \"http:\/\/localhost:8776\/v1\/\%\(tenant_id\)s\"
+ CINDER_INTERNAL_URL: \"http:\/\/localhost:8776\/v1\/\%\(tenant_id\)s\"
+ CINDER_ADMIN_URL: \"http:\/\/localhost:8776\/v1\/\%\(tenant_id\)s\"
+ CINDER_USER_V2: cinderv2
+ CINDER_PUBLIC_URL_V2: \"http:\/\/localhost:8776\/v2\/\%\(tenant_id\)s\"
+ CINDER_INTERNAL_URL_V2: \"http:\/\/localhost:8776\/v2\/\%\(tenant_id\)s\"
+ CINDER_ADMIN_URL_V2: \"http:\/\/localhost:8776\/v2\/\%\(tenant_id\)s\"
diff --git a/openstack-cinder.configure b/openstack-cinder.configure
new file mode 100644
index 00000000..d6e3a48e
--- /dev/null
+++ b/openstack-cinder.configure
@@ -0,0 +1,53 @@
+#!/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
+
+ROOT="$1"
+
+##########################################################################
+# Substitutions in configuration files
+##########################################################################
+
+cat <<EOF > "$ROOT"/etc/openstack-cinder-setup.sed
+s/##CINDER_USER##/$CINDER_USER/g
+s/##CINDER_PASSWORD##/$CINDER_PASSWORD/g
+s/##CINDER_PUBLIC_URL##/$CINDER_PUBLIC_URL/g
+s/##CINDER_INTERNAL_URL##/$CINDER_INTERNAL_URL/g
+s/##CINDER_ADMIN_URL##/$CINDER_ADMIN_URL/g
+s/##CINDER_USER_V2##/$CINDER_USER_V2/g
+s/##CINDER_PUBLIC_URL_V2##/$CINDER_PUBLIC_URL_V2/g
+s/##CINDER_INTERNAL_URL_V2##/$CINDER_INTERNAL_URL_V2/g
+s/##CINDER_ADMIN_URL_V2##/$CINDER_ADMIN_URL_V2/g
+EOF
+
+sed -f "$ROOT"/etc/openstack-cinder-setup.sed -i \
+ "$ROOT"/etc/nova/cinder.conf \
+ "$ROOT"/usr/share/openstack/openstack-cinder-setup
+
+##########################################################################
+
+ln -sf "/etc/systemd/system/openstack-cinder-setup.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-cinder-setup.service"
+
+##########################################################################
+# Add cinder to sudoers controlling which commands is running as a root
+# using the openstack rootwrap.
+##########################################################################
+install -D -m 0440 /proc/self/fd/0 <<'EOF' "$ROOT"/etc/sudoers.d/cinder-rootwrap
+cinder ALL=(root) NOPASSWD: /usr/bin/cinder-rootwrap /etc/cinder/rootwrap.conf *
+EOF
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
diff --git a/systems/openstack-server.morph b/systems/openstack-server.morph
index 3d064f52..930223cd 100644
--- a/systems/openstack-server.morph
+++ b/systems/openstack-server.morph
@@ -38,3 +38,4 @@ configuration-extensions:
- openstack-glance
- openstack-nova
- openstack-rabbitmq
+- openstack-cinder