summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-03-24 13:31:05 +0000
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-03-24 13:31:05 +0000
commit4ef0e9e188ec9d0f2bf093ece1695b862d0994a5 (patch)
tree51ff4096733fb509698717d8c79619ee61c3a142
parent6da5e181efde18ae185d0c514d99b1bb3589ce5d (diff)
downloaddefinitions-4ef0e9e188ec9d0f2bf093ece1695b862d0994a5.tar.gz
Add cinder-configure-backends service
-rw-r--r--openstack-keystone.configure3
-rw-r--r--openstack/etc/systemd/system/openstack-cinder-configure-backends.service11
-rw-r--r--openstack/manifest2
-rw-r--r--openstack/usr/share/openstack/openstack-cinder-configure-backends38
-rw-r--r--openstack/usr/share/openstack/openstack-cinder-setup12
5 files changed, 54 insertions, 12 deletions
diff --git a/openstack-keystone.configure b/openstack-keystone.configure
index d2d1171e..588966f6 100644
--- a/openstack-keystone.configure
+++ b/openstack-keystone.configure
@@ -48,7 +48,8 @@ sed -f "$ROOT"/etc/openstack-keystone-setup.sed -i \
"$ROOT"/usr/share/openstack/openstack-glance-setup \
"$ROOT"/usr/share/openstack/openstack-nova-setup \
"$ROOT"/usr/share/openstack/openstack-neutron-setup \
- "$ROOT"/usr/share/openstack/openstack-cinder-setup
+ "$ROOT"/usr/share/openstack/openstack-cinder-setup \
+ "$ROOT"/usr/share/openstack/openstack-cinder-configure-backends
##########################################################################
diff --git a/openstack/etc/systemd/system/openstack-cinder-configure-backends.service b/openstack/etc/systemd/system/openstack-cinder-configure-backends.service
new file mode 100644
index 00000000..46284636
--- /dev/null
+++ b/openstack/etc/systemd/system/openstack-cinder-configure-backends.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Configure LVM Backends for Cinder
+After=cinder-volume.service cinder-api.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/share/openstack/openstack-cinder-configure-backends
+Restart=no
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/manifest b/openstack/manifest
index 76e989d8..123d1668 100644
--- a/openstack/manifest
+++ b/openstack/manifest
@@ -159,3 +159,5 @@
0100644 0 0 /etc/horizon/openstack_dashboard/local_settings.py
0100644 0 0 /etc/sysctl.conf
0100644 0 0 /etc/hosts
+0100644 0 0 /etc/systemd/system/openstack-cinder-configure-backends.service
+0100755 0 0 /usr/share/openstack/openstack-cinder-configure-backends
diff --git a/openstack/usr/share/openstack/openstack-cinder-configure-backends b/openstack/usr/share/openstack/openstack-cinder-configure-backends
new file mode 100644
index 00000000..2ae06092
--- /dev/null
+++ b/openstack/usr/share/openstack/openstack-cinder-configure-backends
@@ -0,0 +1,38 @@
+#!/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 -xe
+
+# Reconfigure LVM to scan only the devices that contain the
+# cinder-volume volume group
+sed -i 's|# filter = \[ \"a\/\.\*\/\" \]|filter = \[ \"a\/sdb\/\", \"r\/\.\*\/\" \]|' \
+ /etc/lvm/lvm.conf
+
+# Create the cinder LVM type and set a volume backend name
+export OS_USERNAME=temporary_admin
+export OS_PASSWORD=veryinsecure
+export OS_TENANT_NAME=admin
+export OS_AUTH_URL=http://localhost:35357/v2.0
+cinder type-create lvms
+cinder type-key lvms set volume_backend_name=LVM_iSCSI
+
+# Run the target service required for attaching volumes
+depmod -a
+systemctl enable target.service
+systemctl start target.service
+
+exit 0
diff --git a/openstack/usr/share/openstack/openstack-cinder-setup b/openstack/usr/share/openstack/openstack-cinder-setup
index 59fd0085..fc798fe9 100644
--- a/openstack/usr/share/openstack/openstack-cinder-setup
+++ b/openstack/usr/share/openstack/openstack-cinder-setup
@@ -115,6 +115,7 @@ systemctl start openstack-cinder-api
systemctl start openstack-cinder-scheduler
systemctl start openstack-cinder-volume
systemctl start openstack-cinder-backup
+systemctl start openstack-cinder-configure-backends
# Create the links to run nova services when system start next times.
ln -sf "/etc/systemd/system/openstack-cinder-api.service" \
@@ -129,15 +130,4 @@ ln -sf "/etc/systemd/system/openstack-cinder-volume.service" \
ln -sf "/etc/systemd/system/openstack-cinder-backup.service" \
"/etc/systemd/system/multi-user.target.wants/openstack-cinder-backup.service"
-# Create the cinder LVM type and set a volume backend name
-export OS_SERVICE_TOKEN=##KEYSTONE_TEMPORARY_ADMIN_TOKEN##
-export OS_SERVICE_ENDPOINT='http://onenode:35357/v2.0'
-cinder type-create lvms
-cinder type-key lvms set volume_backend_name=LVM_iSCSI
-
-# Run the target service required for attaching volumes
-depmod -a
-systemctl enable target
-systemctl start target
-
exit 0