From 4ef0e9e188ec9d0f2bf093ece1695b862d0994a5 Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Tue, 24 Mar 2015 13:31:05 +0000 Subject: Add cinder-configure-backends service --- openstack-keystone.configure | 3 +- .../openstack-cinder-configure-backends.service | 11 +++++++ openstack/manifest | 2 ++ .../openstack/openstack-cinder-configure-backends | 38 ++++++++++++++++++++++ .../usr/share/openstack/openstack-cinder-setup | 12 +------ 5 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 openstack/etc/systemd/system/openstack-cinder-configure-backends.service create mode 100644 openstack/usr/share/openstack/openstack-cinder-configure-backends 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 -- cgit v1.2.1