summaryrefslogtreecommitdiff
path: root/openstack/usr
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-14 08:52:51 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-16 12:13:45 +0000
commit5be60a9facbe15b93694c99d714f264dd7c67db4 (patch)
treefbe58f8792144f4cffc32f32ee9896b42de9b07f /openstack/usr
parent76bc5fabd58eca8a2859d9f3474276c613aeaaff (diff)
downloaddefinitions-5be60a9facbe15b93694c99d714f264dd7c67db4.tar.gz
Openstack: Make Cinder configurable
Change-Id: I9c2bb1a204a01fa82e90d517663f6cf654666395 Signed-off-by: Pedro Alvarez <pedro.alvarez@codethink.co.uk> Signed-off-by: Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> Signed-off-by: Patrick Darley <patrick.darley@codethink.co.uk>
Diffstat (limited to 'openstack/usr')
-rw-r--r--openstack/usr/lib/systemd/system/openstack-cinder-api.service12
-rw-r--r--openstack/usr/lib/systemd/system/openstack-cinder-backup.service12
-rw-r--r--openstack/usr/lib/systemd/system/openstack-cinder-scheduler.service12
-rw-r--r--openstack/usr/lib/systemd/system/openstack-cinder-setup.service9
-rw-r--r--openstack/usr/lib/systemd/system/openstack-cinder-volume.service12
-rw-r--r--openstack/usr/share/openstack/cinder.yml153
-rw-r--r--openstack/usr/share/openstack/cinder/cinder.conf54
7 files changed, 237 insertions, 27 deletions
diff --git a/openstack/usr/lib/systemd/system/openstack-cinder-api.service b/openstack/usr/lib/systemd/system/openstack-cinder-api.service
new file mode 100644
index 00000000..c863f3f5
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-cinder-api.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenStack Volume Service (code-named Cinder) API server
+After=syslog.target network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=cinder
+ExecStart=/usr/bin/cinder-api --config-file /etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-api.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-cinder-backup.service b/openstack/usr/lib/systemd/system/openstack-cinder-backup.service
new file mode 100644
index 00000000..2f489228
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-cinder-backup.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenStack Cinder backup server
+After=syslog.target network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=cinder
+ExecStart=/usr/bin/cinder-backup --config-file /etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-backup.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-cinder-scheduler.service b/openstack/usr/lib/systemd/system/openstack-cinder-scheduler.service
new file mode 100644
index 00000000..025f1f3c
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-cinder-scheduler.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenStack Cinder scheduler server
+After=syslog.target network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=cinder
+ExecStart=/usr/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-scheduler.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-cinder-setup.service b/openstack/usr/lib/systemd/system/openstack-cinder-setup.service
new file mode 100644
index 00000000..bac80b6b
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-cinder-setup.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run cinder-setup Ansible scripts
+After=local-fs.target openstack-keystone-setup.service postgres-server.service
+
+[Service]
+ExecStart=/usr/bin/ansible-playbook -v -M /usr/share/ansible/ansible-openstack-modules -i /usr/share/openstack/hosts /usr/share/openstack/cinder.yml
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/lib/systemd/system/openstack-cinder-volume.service b/openstack/usr/lib/systemd/system/openstack-cinder-volume.service
new file mode 100644
index 00000000..4a8da9c3
--- /dev/null
+++ b/openstack/usr/lib/systemd/system/openstack-cinder-volume.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenStack Cinder volume server
+After=syslog.target network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=cinder
+ExecStart=/usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-volume.log
+
+[Install]
+WantedBy=multi-user.target
diff --git a/openstack/usr/share/openstack/cinder.yml b/openstack/usr/share/openstack/cinder.yml
new file mode 100644
index 00000000..29490843
--- /dev/null
+++ b/openstack/usr/share/openstack/cinder.yml
@@ -0,0 +1,153 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/cinder.conf"
+ tasks:
+
+# Configure iscsid, this can go in a separate script
+ - name: Update kernel module dependencies
+ command: depmod -a
+
+ - name: generate InitiatorName for iscsi
+ shell: iscsi-iname
+ register: initiator_name
+
+ - lineinfile:
+ dest: /etc/iscsi/initiatorname.iscsi
+ regexp: '^InitiatorName=$'
+ line: 'InitiatorName={{ initiator_name.stdout }}'
+ backrefs: yes
+
+ - name: Enable and start iscsid
+ service:
+ name: "{{ item }}"
+ enabled: yes
+ state: started
+ with_items:
+ - iscsid
+
+# Configure LVM and target for Cinder
+ - name: Check that CINDER_DEVICE exists
+ stat:
+ path: "{{ CINDER_DEVICE }}"
+ register: cinder_device_stats
+ failed_when: cinder_device_stats.stat.exists == false
+
+ - name: Configure LVM group for cinder
+ lvg:
+ vg: cinder-volumes
+ pvs: "{{ CINDER_DEVICE }}"
+
+ - lineinfile:
+ dest: /etc/lvm/lvm.conf
+ regexp: '# filter = \[ \"a\/\.\*/\" \]'
+ line: ' filter = [ "a|{{ CINDER_DEVICE }}|", "r/.*/" ]'
+ backrefs: yes
+
+ - name: Enable and start lvm2-lvmetad and target services
+ service:
+ name: "{{ item }}"
+ enabled: yes
+ state: started
+ with_items:
+ - lvm2-lvmetad
+ - target
+
+# Configure cinder
+ - name: Create the cinder user.
+ user:
+ name: cinder
+ comment: Openstack Cinder Daemons
+ shell: /sbin/nologin
+ home: /var/lib/cinder
+
+ - name: Create the /var folders for cinder
+ file:
+ path: "{{ item }}"
+ state: directory
+ owner: cinder
+ group: cinder
+ with_items:
+ - /var/run/cinder
+ - /var/lock/cinder
+ - /var/log/cinder
+ - /var/lib/cinder
+ - /var/lib/cinder/volumer
+
+ - name: Create /etc/cinder directory
+ file:
+ path: /etc/cinder
+ state: directory
+
+ - name: Add the configuration needed for cinder in /etc/cinder using templates
+ template:
+ src: /usr/share/openstack/cinder/{{ item }}
+ dest: /etc/cinder/{{ item }}
+ with_lines:
+ - cd /usr/share/openstack/cinder && find -type f
+
+ - name: Create cinder service user in service tenant
+ keystone_user:
+ user: "{{ CINDER_SERVICE_USER }}"
+ password: "{{ CINDER_SERVICE_PASSWORD }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Assign admin role to cinder service user in the service tenant
+ keystone_user:
+ role: admin
+ user: "{{ CINDER_SERVICE_USER }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Add cinder endpoint
+ keystone_service:
+ name: cinder
+ type: volume
+ description: Openstack Block Storage
+ publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ region: regionOne
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Add cinderv2 endpoint
+ keystone_service:
+ name: cinderv2
+ type: volumev2
+ description: Openstack Block Storage
+ publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ region: regionOne
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Create postgresql user for cinder
+ postgresql_user:
+ name: "{{ CINDER_DB_USER }}"
+ sudo: yes
+ sudo_user: cinder
+
+ - name: Create database for cinder services
+ postgresql_db:
+ name: cinder
+ owner: "{{ CINDER_DB_USER }}"
+ sudo: yes
+ sudo_user: cinder
+
+ - name: Initiate cinder database
+ cinder_manage:
+ action: dbsync
+ sudo: yes
+ sudo_user: cinder
+
+ - name: Enable and start openstack-cinder services
+ service:
+ name: "{{ item }}"
+ enabled: yes
+ state: started
+ with_items:
+ - openstack-cinder-api
+ - openstack-cinder-scheduler
+ - openstack-cinder-volume
+ - openstack-cinder-backup
diff --git a/openstack/usr/share/openstack/cinder/cinder.conf b/openstack/usr/share/openstack/cinder/cinder.conf
index 30c3f15b..1ca21082 100644
--- a/openstack/usr/share/openstack/cinder/cinder.conf
+++ b/openstack/usr/share/openstack/cinder/cinder.conf
@@ -76,11 +76,11 @@
# The RabbitMQ broker address where a single node is used.
# (string value)
-#rabbit_host=localhost
+rabbit_host={{ RABBITMQ_HOST }}
# The RabbitMQ broker port where a single node is used.
# (integer value)
-#rabbit_port=5672
+rabbit_port={{ RABBITMQ_PORT }}
# RabbitMQ HA cluster host:port pairs. (list value)
#rabbit_hosts=$rabbit_host:$rabbit_port
@@ -89,12 +89,12 @@
#rabbit_use_ssl=false
# The RabbitMQ userid. (string value)
-#rabbit_userid=guest
+rabbit_userid={{ RABBITMQ_USER }}
# The RabbitMQ password. (string value)
-#rabbit_password=guest
+rabbit_password={{ RABBITMQ_PASSWORD }}
-# The RabbitMQ login method. (string value)
+# the RabbitMQ login method (string value)
#rabbit_login_method=AMQPLAIN
# The RabbitMQ virtual host. (string value)
@@ -178,7 +178,7 @@
# The messaging driver to use, defaults to rabbit. Other
# drivers include qpid and zmq. (string value)
-#rpc_backend=rabbit
+rpc_backend=rabbit
# The default exchange under which topics are scoped. May be
# overridden by an exchange name specified in the
@@ -492,18 +492,18 @@
# File name for the paste.deploy config for cinder-api (string
# value)
-#api_paste_config=api-paste.ini
+api_paste_config=api-paste.ini
# Top-level directory for maintaining cinder's state (string
# value)
# Deprecated group/name - [DEFAULT]/pybasedir
-#state_path=/var/lib/cinder
+state_path=/var/lib/cinder
# IP address of this host (string value)
-#my_ip=10.0.0.1
+my_ip={{ MANAGEMENT_INTERFACE_IP_ADDRESS }}
# Default glance host name or IP (string value)
-#glance_host=$my_ip
+glance_host={{ CONTROLLER_HOST_ADDRESS }}
# Default glance port (integer value)
#glance_port=9292
@@ -597,7 +597,7 @@
# Path to the rootwrap configuration file to use for running
# commands as root (string value)
-#rootwrap_config=/etc/cinder/rootwrap.conf
+rootwrap_config=/etc/cinder/rootwrap.conf
# Enable monkey patching (boolean value)
#monkey_patch=false
@@ -619,7 +619,7 @@
# The strategy to use for auth. Supports noauth, keystone, and
# deprecated. (string value)
-#auth_strategy=noauth
+auth_strategy=keystone
# A list of backend names to use. These backend names should
# be backed by a unique [CONFIG] group with its options (list
@@ -699,7 +699,7 @@
# Template string to be used to generate volume names (string
# value)
-#volume_name_template=volume-%s
+volume_name_template=volume-%s
# Template string to be used to generate snapshot names
# (string value)
@@ -764,7 +764,7 @@
# Directory to use for lock files. Default to a temp directory
# (string value)
-#lock_path=<None>
+lock_path=/var/lock/cinder
#
@@ -848,7 +848,7 @@
# Use syslog for logging. Existing syslog format is DEPRECATED
# during I, and will change in J to honor RFC5424. (boolean
# value)
-#use_syslog=false
+use_syslog = True
# (Optional) Enables or disables syslog rfc5424 format for
# logging. If enabled, prefixes the MSG part of the syslog
@@ -1031,7 +1031,7 @@
# The IP address that the iSCSI daemon is listening on (string
# value)
-#iscsi_ip_address=$my_ip
+iscsi_ip_address={{ MANAGEMENT_INTERFACE_IP_ADDRESS }}
# The port that the iSCSI daemon is listening on (integer
# value)
@@ -1044,7 +1044,7 @@
# The backend name for a given driver implementation (string
# value)
-#volume_backend_name=<None>
+volume_backend_name=LVM_iSCSI
# Do we attach/detach volumes in cinder using multipath for
# volume to image and image to volume transfers? (boolean
@@ -1067,10 +1067,10 @@
# iSCSI target user-land tool to use. tgtadm is default, use
# lioadm for LIO iSCSI support, iseradm for the ISER protocol,
# or fake for testing. (string value)
-#iscsi_helper=tgtadm
+iscsi_helper=lioadm
# Volume configuration file storage directory (string value)
-#volumes_dir=$state_path/volumes
+volumes_dir=$state_path/volumes
# IET configuration file (string value)
#iet_conf=/etc/iet/ietd.conf
@@ -1565,7 +1565,7 @@
# Name for the VG that will contain exported volumes (string
# value)
-#volume_group=cinder-volumes
+volume_group=cinder-volumes
# If >0, create LVs with multiple mirrors. Note that this
# requires lvm_mirrors + 2 PVs with available space (integer
@@ -2267,7 +2267,7 @@
#
# Driver to use for volume creation (string value)
-#volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
+volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
# Timeout for creating the volume to migrate to when
# performing volume migration (seconds) (integer value)
@@ -2368,7 +2368,7 @@
# Deprecated group/name - [DEFAULT]/sql_connection
# Deprecated group/name - [DATABASE]/sql_connection
# Deprecated group/name - [sql]/connection
-#connection=<None>
+connection=postgresql://{{ CINDER_DB_USER }}:{{ CINDER_DB_PASSWORD }}@{{ CONTROLLER_HOST_ADDRESS }}/cinder
# The SQLAlchemy connection string to use to connect to the
# slave database. (string value)
@@ -2557,12 +2557,12 @@
#auth_protocol=https
# Complete public Identity API endpoint (string value)
-#auth_uri=<None>
+auth_uri = http://{{ CONTROLLER_HOST_ADDRESS }}:5000/v2.0
# Complete admin Identity API endpoint. This should specify
# the unversioned root endpoint e.g. https://localhost:35357/
# (string value)
-#identity_uri=<None>
+identity_uri = http://{{ CONTROLLER_HOST_ADDRESS }}:35357
# API version of the admin Identity API endpoint (string
# value)
@@ -2590,14 +2590,14 @@
#admin_token=<None>
# Keystone account username (string value)
-#admin_user=<None>
+admin_user={{ CINDER_SERVICE_USER }}
# Keystone account password (string value)
-#admin_password=<None>
+admin_password={{ CINDER_SERVICE_PASSWORD }}
# Keystone service account tenant name to validate user tokens
# (string value)
-#admin_tenant_name=admin
+admin_tenant_name=service
# Env key for the swift cache (string value)
#cache=<None>