Merge "Allow cinder-volume to be configured to use NFS"

This commit is contained in:
Jenkins 2016-11-11 16:58:30 +00:00 committed by Gerrit Code Review
commit 7178e13d78
9 changed files with 45 additions and 35 deletions

View File

@ -254,6 +254,7 @@ enable_ceph_rgw: "no"
enable_cinder: "no"
enable_cinder_backend_iscsi: "no"
enable_cinder_backend_lvm: "no"
enable_cinder_backend_nfs: "no"
enable_cloudkitty: "no"
enable_congress: "no"
enable_etcd: "no"

View File

@ -74,5 +74,8 @@ cinder_backends:
- name: "lvm-1"
driver: "lvm"
enabled: "{{ enable_cinder_backend_lvm | bool }}"
- name: "nfs-1"
driver: "nfs"
enabled: "{{ enable_cinder_backend_nfs | bool }}"
cinder_enabled_backends: "{{ cinder_backends|selectattr('enabled', 'equalto', true)|list }}"

View File

@ -49,3 +49,14 @@
dest: "{{ node_config_directory }}/cinder/policy.json"
when:
cinder_policy.stat.exists
- name: Copying over nfs_shares files for cinder_volume
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/cinder-volume/nfs_shares"
with_first_found:
- "{{ node_custom_config }}/nfs_shares.j2"
- "{{ node_custom_config }}/cinder/nfs_shares.j2"
- "{{ node_custom_config }}/cinder/cinder-volume/nfs_shares.j2"
- "{{ node_custom_config }}/cinder/{{ inventory_hostname }}/nfs_shares.j2"
when: enable_cinder_backend_nfs | bool

View File

@ -6,19 +6,28 @@
"dest": "/etc/cinder/cinder.conf",
"owner": "cinder",
"perm": "0600"
}{% if cinder_backend_ceph | bool %},
},
{
"source": "{{ container_config_directory }}/ceph.*",
"dest": "/etc/ceph/",
"owner": "cinder",
"perm": "0700"
"perm": "0700",
"optional": {{ (not cinder_backend_ceph | bool) | string | lower }}
},
{
"source": "{{ container_config_directory }}/ceph.conf",
"dest": "/etc/ceph/ceph.conf",
"owner": "cinder",
"perm": "0600"
}{% endif %}
"perm": "0600",
"optional": {{ (not cinder_backend_ceph | bool) | string | lower }}
},
{
"source": "{{ container_config_directory }}/nfs_shares",
"dest": "/etc/cinder/nfs_shares",
"owner": "cinder",
"perm": "0600",
"optional": {{ (not enable_cinder_backend_nfs | bool) | string | lower }}
}
],
"permissions": [
{

View File

@ -99,5 +99,12 @@ rbd_secret_uuid = {{ rbd_secret_uuid }}
report_discard_supported = True
{% endif %}
{% if enable_cinder_backend_nfs | bool %}
[nfs-1]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
volume_backend_name = nfs-1
nfs_shares_config = /etc/cinder/nfs_shares
{% endif %}
[privsep_entrypoint]
helper_command=sudo cinder-rootwrap /etc/cinder/rootwrap.conf privsep-helper --config-file /etc/cinder/cinder.conf

View File

@ -17,6 +17,7 @@
- "kolla_logs:/var/log/kolla/"
- "libvirtd:/var/lib/libvirt"
- "nova_compute:/var/lib/nova/"
- "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
- "nova_libvirt_qemu:/etc/libvirt/qemu"
register: start_nova_libvirt_container
# NOTE(Jeffrey4l): retry 5 to remove nova_libvirt container because when
@ -37,6 +38,7 @@
- "{% if enable_iscsid | bool %}iscsi_info:/etc/iscsi{% endif %}"
- "libvirtd:/var/lib/libvirt"
- "nova_compute:/var/lib/nova/"
- "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
- name: Starting nova-compute container
kolla_docker:
@ -94,6 +96,7 @@
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
- "nova_compute:/var/lib/nova"
- "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
- "heka_socket:/var/lib/kolla/heka/"
# TODO(jeffrey4l): how to handle the nova-compute-fake and
# nova-compute-ironic

View File

@ -1,29 +0,0 @@
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }}
{% block cinder_rpcbind_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set cinder_rpcbind_packages = [
'nfs-utils',
'nfs-utils-lib'
] %}
{% elif base_distro in ['ubuntu', 'debian'] %}
{% set cinder_rpcbind_packages = [
'rpcbind'
] %}
{% endif %}
{{ macros.install_packages(cinder_rpcbind_packages | customizable("packages")) }}
{% block cinder_rpcbind_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }}
USER cinder

View File

@ -8,6 +8,7 @@ MAINTAINER {{ maintainer }}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set cinder_volume_packages = [
'nfs-utils',
'scsi-target-utils'
] %}
@ -35,11 +36,11 @@ RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf
{% if base_distro in ['ubuntu', 'debian'] %}
{% set cinder_volume_packages = [
'cinder-volume'
'cinder-volume',
'nfs-common'
] %}
{{ macros.install_packages(cinder_volume_packages | customizable("packages")) }}
{% endif %}
{% endif %}

View File

@ -15,6 +15,7 @@ MAINTAINER {{ maintainer }}
'ceph-common',
'genisoimage',
'iscsi-initiator-utils',
'nfs-utils',
'targetcli',
'python-rtslib'
] %}
@ -32,6 +33,7 @@ MAINTAINER {{ maintainer }}
'ironic-common',
'python-ironicclient',
'genisoimage',
'nfs-common',
'open-iscsi',
'targetcli',
'python-rtslib'
@ -53,6 +55,7 @@ RUN rm -f /etc/nova/nova-compute.conf
'ceph-common',
'genisoimage',
'iscsi-initiator-utils',
'nfs-utils',
'targetcli',
'python-rtslib'
] %}
@ -64,6 +67,7 @@ RUN rm -f /etc/nova/nova-compute.conf
'qemu-utils',
'ceph-common',
'genisoimage',
'nfs-common',
'open-iscsi',
'targetcli',
'python-rtslib'