Add CephFS backend in Manila

Depends-On: I5bf14a668a9e8976a18aa28a5bbfe586690bbd31
Implements: blueprint manila-cephfs-backend

Change-Id: I483be398d929429e35e460b5a7660b82f409b587
This commit is contained in:
caowei 2017-12-11 17:08:18 +08:00
parent c2d2cdf715
commit 1961929df6
11 changed files with 160 additions and 1 deletions

View File

@ -432,6 +432,8 @@ enable_magnum: "no"
enable_manila: "no"
enable_manila_backend_generic: "no"
enable_manila_backend_hnas: "no"
enable_manila_backend_cephfs_native: "no"
enable_manila_backend_cephfs_nfs: "no"
enable_mistral: "no"
enable_mongodb: "no"
enable_multipathd: "no"

View File

@ -101,8 +101,25 @@ manila_backends:
- name: "generic"
driver: "generic"
enabled: "{{ enable_manila_backend_generic | bool }}"
protocols:
- "NFS"
- "CIFS"
- name: "hnas1"
driver: "hnas"
enabled: "{{ enable_manila_backend_hnas | bool }}"
protocols:
- "NFS"
- "CIFS"
- name: "cephfsnative1"
driver: "cephfsnative"
enabled: "{{ enable_manila_backend_cephfs_native | bool }}"
protocols:
- "CEPHFS"
- name: "cephfsnfs1"
driver: "cephfsnfs"
enabled: "{{ enable_manila_backend_cephfs_nfs | bool }}"
protocols:
- "NFS"
- "CIFS"
manila_enabled_backends: "{{ manila_backends|selectattr('enabled', 'equalto', true)|list }}"

View File

@ -0,0 +1,26 @@
---
- name: Ensuring config directory exists
file:
path: "{{ node_config_directory }}/manila-share"
state: "directory"
- name: Copying over ceph.conf for manila
merge_configs:
sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"
- "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf"
dest: "{{ node_config_directory }}/manila-share/ceph.conf"
- name: Pulling cephx keyring for manila
command: docker exec ceph_mon ceph auth get-or-create client.manila mon 'allow r, allow command "auth del", allow command "auth caps", allow command "auth get", allow command "auth get-or-create"' osd 'allow rw' mds 'allow *'
register: cephx_key_manila
delegate_to: "{{ groups['ceph-mon'][0] }}"
changed_when: False
run_once: True
- name: Pushing cephx keyring
copy:
content: "{{ cephx_key_manila.stdout }}\n\r"
dest: "{{ node_config_directory }}/manila-share/ceph.client.manila.keyring"
mode: "0600"

View File

@ -1,4 +1,19 @@
---
- include: ceph.yml
when:
- enable_ceph | bool
- enable_ceph_mds | bool
- (enable_manila_backend_cephfs_native | bool) or (enable_manila_backend_cephfs_nfs | bool)
- inventory_hostname in groups['manila-share']
- include: external_ceph.yml
when:
- enable_ceph| bool == False
- enable_ceph_mds| bool == False
- (enable_manila_backend_cephfs_native | bool) or (enable_manila_backend_cephfs_nfs | bool)
- inventory_hostname in groups['manila-share']
- include: register.yml
when: inventory_hostname in groups['manila-api']

View File

@ -0,0 +1,20 @@
---
- name: Ensuring config directory exists
file:
path: "{{ node_config_directory }}/manila-share"
state: "directory"
- name: Copying over ceph.conf for manila
merge_configs:
sources:
- "{{ node_custom_config }}/manila/ceph.conf"
- "{{ node_custom_config }}/manila/manila-share/ceph.conf"
dest: "{{ node_config_directory }}/manila-share/ceph.conf"
- name: Copy over Ceph keyring files for manila
copy:
src: "{{ item }}"
dest: "{{ node_config_directory }}/manila-share/"
with_fileglob:
- "{{ node_custom_config }}/manila/ceph.client.manila.keyring"
- "{{ node_custom_config }}/manila/manila/ceph.client.manila.keyring"

View File

@ -84,3 +84,28 @@ hitachi_hnas_evs_id = {{ hnas_evs_id }}
hitachi_hnas_evs_ip = {{ hnas_evs_ip }}
hitachi_hnas_file_system_name = {{ hnas_file_system_name }}
{% endif %}
{% if enable_manila_backend_cephfs_native | bool %}
[cephfsnative1]
driver_handles_share_servers = False
share_backend_name = CEPHFS1
share_driver = manila.share.drivers.cephfs.cephfs_native.CephFSNativeDriver
cephfs_conf_path = /etc/ceph/ceph.conf
cephfs_auth_id = manila
cephfs_cluster_name = ceph
cephfs_enable_snapshots = False
{% endif %}
{% if enable_manila_backend_cephfs_nfs | bool %}
[cephfsnfs1]
driver_handles_share_servers = False
share_backend_name = CEPHFSNFS1
share_driver = manila.share.drivers.cephfs.driver.CephFSDriver
cephfs_protocol_helper_type = NFS
cephfs_conf_path = /etc/ceph/ceph.conf
cephfs_auth_id = manila
cephfs_cluster_name = ceph
cephfs_enable_snapshots = False
cephfs_ganesha_server_is_remote= False
cephfs_ganesha_server_ip = {{ api_interface_address }}
{% endif %}

View File

@ -6,7 +6,13 @@
"dest": "/etc/manila/manila.conf",
"owner": "manila",
"perm": "0600"
},
}{% if enable_manila_backend_cephfs_native | bool or enable_manila_backend_cephfs_nfs | bool %},
{
"source": "{{ container_config_directory }}/ceph.*",
"dest": "/etc/ceph/",
"owner": "manila",
"perm": "0600"
}{% endif %},
{
"source": "{{ container_config_directory }}/policy.json",
"dest": "/etc/manila/policy.json",

View File

@ -13,6 +13,8 @@ osapi_share_workers = {{ openstack_service_workers }}
rootwrap_config = /etc/manila/rootwrap.conf
api_paste_config = /etc/manila/api-paste.ini
enabled_share_protocols = "{{ manila_backends|selectattr('enabled', 'equalto', true)|sum(attribute='protocols', start=[]) | unique | join(',') }}"
auth_strategy = keystone
os_region_name = {{ openstack_region_name }}

View File

@ -37,6 +37,7 @@ service in ``/etc/kolla/globals.yml``:
cinder_backend_ceph: "yes"
nova_backend_ceph: "yes"
gnocchi_backend_storage: "ceph"
enable_manila_backend_ceph_native: "yes"
The combination of ``enable_ceph: "no"`` and ``<service>_backend_ceph: "yes"``
triggers the activation of external ceph mechanism in Kolla.
@ -226,3 +227,43 @@ Put ceph.conf and gnocchi client keyring file in
$ ls /etc/kolla/config/gnocchi
ceph.client.gnocchi.keyring ceph.conf gnocchi.conf
Manila
------
Configuring Manila for Ceph includes four steps:
1) Configure CephFS backend, setting enable_manila_backend_ceph_native
2) Create Ceph configuration file in /etc/ceph/ceph.conf
3) Create Ceph keyring file in /etc/ceph/ceph.client.<username>.keyring
4) Setup Manila in the usual way
Step 1 is done by using setting enable_manila_backend_ceph_native=true
Now put ceph.conf and the keyring file (name depends on the username created
in Ceph) into the same directory, for example:
/etc/kolla/config/manila/ceph.conf
::
[global]
fsid = 1d89fec3-325a-4963-a950-c4afedd37fe3
mon_host = 192.168.0.56
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
/etc/kolla/config/manila/ceph.client.manila.keyring
::
[client.manila]
key = AQAg5YRXS0qxLRAAXe6a4R1a15AoRx7ft80DhA==
For more details on the rest of the Manila setup, such as creating the share
type ``default_share_type``, please see:
https://docs.openstack.org/kolla-ansible/latest/reference/manila-guide.html
For more details on the CephFS Native driver, please see:
https://docs.openstack.org/manila/latest/admin/cephfs_driver.html

View File

@ -192,6 +192,8 @@ kolla_internal_vip_address: "10.10.10.254"
#enable_manila: "no"
#enable_manila_backend_generic: "no"
#enable_manila_backend_hnas: "no"
#enable_manila_backend_cephfs_native: "no"
#enable_manila_backend_cephfs_nfs: "no"
#enable_mistral: "no"
#enable_mongodb: "no"
#enable_murano: "no"

View File

@ -0,0 +1,3 @@
---
features:
- Add CephFS driver support to manila