Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Commit

Permalink
WIP: Cinder LVM Support
Browse files Browse the repository at this point in the history
This adds the ability for cinder to use LVM as a backend
  • Loading branch information
wilkers-steve committed Mar 27, 2017
1 parent e111e8b commit 02d557e
Show file tree
Hide file tree
Showing 13 changed files with 534 additions and 129 deletions.
4 changes: 2 additions & 2 deletions cinder/templates/bin/_db-init.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ set -ex
export HOME=/tmp

ansible localhost -vvv \
-m mysql_db -a "login_host='{{ .Values.database.address }}' \
-m mysql_db -a "login_host='{{ include "helm-toolkit.mariadb_host" . }}' \
login_port='{{ .Values.database.port }}' \
login_user='{{ .Values.database.root_user }}' \
login_password='{{ .Values.database.root_password }}' \
name='{{ .Values.database.cinder_database_name }}'"

ansible localhost -vvv \
-m mysql_user -a "login_host='{{ .Values.database.address }}' \
-m mysql_user -a "login_host='{{ include "helm-toolkit.mariadb_host" . }}' \
login_port='{{ .Values.database.port }}' \
login_user='{{ .Values.database.root_user }}' \
login_password='{{ .Values.database.root_password }}' \
Expand Down
19 changes: 19 additions & 0 deletions cinder/templates/bin/_disable-udev.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

sed -i "s|udev_rules = 1|udev_rules = 0|g" /etc/lvm/lvm.conf
sed -i "s|udev_sync = 1|udev_sync = 0|g" /etc/lvm/lvm.conf
4 changes: 4 additions & 0 deletions cinder/templates/configmap-bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ metadata:
data:
db-init.sh: |+
{{ tuple "bin/_db-init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{ if .Values.lvm.enabled }}
disable-udev.sh: |+
{{ tuple "bin/_disable-udev.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
{{ end }}
ks-service.sh: |+
{{- include "helm-toolkit.keystone_service" . | indent 4 }}
ks-endpoints.sh: |+
Expand Down
4 changes: 4 additions & 0 deletions cinder/templates/configmap-etc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ metadata:
data:
cinder.conf: |+
{{ tuple "etc/_cinder.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
rootwrap.conf: |+
{{ tuple "etc/_rootwrap.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
volume.filters: |+
{{ tuple "etc/_volume.filters.tpl" . | include "helm-toolkit.template" | indent 4 }}
api-paste.ini: |+
{{ tuple "etc/_cinder-api-paste.ini.tpl" . | include "helm-toolkit.template" | indent 4 }}
policy.json: |+
Expand Down
36 changes: 6 additions & 30 deletions cinder/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.api }}
{{- $mounts_cinder_api := .Values.mounts.cinder_api.cinder_api }}
{{- $mounts_cinder_api_init := .Values.mounts.cinder_api.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,7 +39,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_api_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
Expand Down Expand Up @@ -65,33 +68,6 @@ spec:
tcpSocket:
port: {{ .Values.network.port.api }}
volumeMounts:
- name: pod-etc-cinder
mountPath: /etc/cinder
- name: pod-var-cache-cinder
mountPath: /var/cache/cinder
- name: cinderconf
mountPath: /etc/cinder/conf/cinder.conf
subPath: cinder.conf
readOnly: true
- name: cinderpaste
mountPath: /etc/cinder/api-paste.ini
subPath: api-paste.ini
readOnly: true
- name: cinderpolicy
mountPath: /etc/cinder/policy.json
subPath: policy.json
readOnly: true
{{ toYaml $mounts_cinder_api.volumeMounts | indent 12 }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
- name: pod-var-cache-cinder
emptyDir: {}
- name: cinderconf
configMap:
name: cinder-etc
- name: cinderpaste
configMap:
name: cinder-etc
- name: cinderpolicy
configMap:
name: cinder-etc
{{ toYaml $mounts_cinder_api.volumes | indent 8 }}
36 changes: 6 additions & 30 deletions cinder/templates/deployment-scheduler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.scheduler }}
{{- $mounts_cinder_scheduler := .Values.mounts.cinder_scheduler.cinder_scheduler }}
{{- $mounts_cinder_scheduler_init := .Values.mounts.cinder_scheduler.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,7 +39,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_scheduler_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
Expand All @@ -59,33 +62,6 @@ spec:
- --config-dir
- /etc/cinder/conf
volumeMounts:
- name: pod-etc-cinder
mountPath: /etc/cinder
- name: pod-var-cache-cinder
mountPath: /var/cache/cinder
- name: cinderconf
mountPath: /etc/cinder/conf/cinder.conf
subPath: cinder.conf
readOnly: true
- name: cinderpaste
mountPath: /etc/cinder/api-paste.ini
subPath: api-paste.ini
readOnly: true
- name: cinderpolicy
mountPath: /etc/cinder/policy.json
subPath: policy.json
readOnly: true
{{ toYaml $mounts_cinder_scheduler.volumeMounts | indent 12 }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
- name: pod-var-cache-cinder
emptyDir: {}
- name: cinderconf
configMap:
name: cinder-etc
- name: cinderpaste
configMap:
name: cinder-etc
- name: cinderpolicy
configMap:
name: cinder-etc
{{ toYaml $mounts_cinder_scheduler.volumes | indent 8 }}
51 changes: 21 additions & 30 deletions cinder/templates/deployment-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.volume }}
{{- $mounts_cinder_volume := .Values.mounts.cinder_volume.cinder_volume }}
{{- $mounts_cinder_volume_init := .Values.mounts.cinder_volume.init_container }}

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -36,13 +39,16 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
{{ tuple $envAll $dependencies $mounts_cinder_volume_init | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: cinder-volume
securityContext:
privileged: true
runAsUser: 0
image: {{ .Values.images.volume }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{- if .Values.resources.enabled }}
Expand All @@ -59,33 +65,18 @@ spec:
- --config-dir
- /etc/cinder/conf
volumeMounts:
- name: pod-etc-cinder
mountPath: /etc/cinder
- name: pod-var-cache-cinder
mountPath: /var/cache/cinder
- name: cinderconf
mountPath: /etc/cinder/conf/cinder.conf
subPath: cinder.conf
readOnly: true
- name: cephconf
mountPath: /etc/ceph/ceph.conf
subPath: ceph.conf
readOnly: true
- name: cephclientcinderkeyring
mountPath: /etc/ceph/ceph.client.{{ .Values.ceph.cinder_user }}.keyring
subPath: ceph.client.{{ .Values.ceph.cinder_user }}.keyring
readOnly: true
{{ toYaml $mounts_cinder_volume.volumeMounts | indent 12 }}
{{ if .Values.ceph.enabled }}
{{ toYaml $mounts_cinder_volume.ceph_volumeMounts | indent 12 }}
{{ end }}
{{ if .Values.lvm.enabled }}
{{ toYaml $mounts_cinder_volume.lvm_volumeMounts | indent 12 }}
{{ end }}
volumes:
- name: pod-etc-cinder
emptyDir: {}
- name: pod-var-cache-cinder
emptyDir: {}
- name: cinderconf
configMap:
name: cinder-etc
- name: cephconf
configMap:
name: cinder-etc
- name: cephclientcinderkeyring
configMap:
name: cinder-etc
{{ toYaml $mounts_cinder_volume.volumes | indent 8 }}
{{ if .Values.ceph.enabled }}
{{ toYaml $mounts_cinder_volume.ceph_volumes | indent 8 }}
{{ end }}
{{ if .Values.lvm.enabled }}
{{ toYaml $mounts_cinder_volume.lvm_volumes | indent 8 }}
{{ end }}
22 changes: 22 additions & 0 deletions cinder/templates/etc/_cinder.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use_stderr = True
enable_v1_api = false
volume_name_template = %s

per_volume_size_limit = 10

osapi_volume_workers = {{ .Values.api.workers }}
osapi_volume_listen = 0.0.0.0
osapi_volume_listen_port = {{ .Values.network.port.api }}
Expand All @@ -39,6 +41,10 @@ os_region_name = {{ .Values.keystone.cinder_region_name }}
# by pinning the agent identifier
host=cinder-volume-worker

# Path to the rootwrap configuration file to use for running commands as root
# (string value)
rootwrap_config = /etc/cinder/rootwrap.conf

[database]
connection = mysql+pymysql://{{ .Values.database.cinder_user }}:{{ .Values.database.cinder_password }}@{{ .Values.database.address }}:{{ .Values.database.port }}/{{ .Values.database.cinder_database_name }}
max_retries = -1
Expand All @@ -63,6 +69,7 @@ rabbit_password = {{ .Values.messaging.password }}
rabbit_ha_queues = true
rabbit_hosts = {{ .Values.messaging.hosts }}

{{ if .Values.ceph.enabled }}
[rbd1]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = {{ .Values.backends.rbd1.pool }}
Expand All @@ -78,3 +85,18 @@ rbd_secret_uuid = {{- include "secrets/ceph-client-key" . -}}
{{- end }}
rbd_secret_uuid = {{ .Values.backends.rbd1.secret }}
report_discard_supported = True
{{ end }}

{{ if .Values.lvm.enabled }}
[lvm1]
iscsi_helper = tgtadm
iscsi_protocol = iscsi
lvm_conf_file = /etc/cinder/lvm.conf
lvm_type = default
volume_backend_name = lvm1
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes

[privsep_entrypoint]
helper_command=sudo cinder-rootwrap /etc/cinder/rootwrap.conf privsep-helper --config-file /etc/cinder/cinder.conf
{{ end }}
27 changes: 27 additions & 0 deletions cinder/templates/etc/_rootwrap.conf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration for cinder-rootwrap
# This file should be owned by (and only-writeable by) the root user

[DEFAULT]
# List of directories to load filter definitions from (separated by ',').
# These directories MUST all be only writeable by root !
filters_path=/etc/cinder/rootwrap.d

# List of directories to search executables in, in case filters do not
# explicitely specify a full path (separated by ',')
# If not specified, defaults to system PATH environment variable.
# These directories MUST all be only writeable by root !
exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin

# Enable logging to syslog
# Default value is False
use_syslog=False

# Which syslog facility to use.
# Valid values include auth, authpriv, syslog, local0, local1...
# Default value is 'syslog'
syslog_log_facility=syslog

# Which messages to log.
# INFO means log all usage
# ERROR means only log unsuccessful attempts
syslog_log_level=ERROR
Loading

0 comments on commit 02d557e

Please sign in to comment.