From f01492b11c81e6f5ec9773c2eb39612033992c35 Mon Sep 17 00:00:00 2001 From: linpeiwen Date: Sun, 16 Aug 2020 02:37:06 +0000 Subject: [PATCH] Add support for GlusterFS NFS Manila backend Follows existing backends patterns to add support for the GlusterFS NFS driver. NFS server type used by the GlusterFS backend, Gluster or Ganesha, currently supports Gluster. The GlusterFS NFS driver needs to install the glusterfs-fuse package in the kolla images manila share container in advance, which has been merged in https://review.opendev.org/747510 Change-Id: I7fdb121b5bf9850d62246a24f9b17d226028c2ca --- ansible/group_vars/all.yml | 1 + ansible/roles/manila/defaults/main.yml | 13 ++++ .../manila/templates/manila-share.conf.j2 | 20 ++++++ doc/source/reference/storage/manila-guide.rst | 63 +++++++++++++++++++ etc/kolla/globals.yml | 32 ++++++++++ ...S-NFS-Manila-backend-fa8a54e06adb0714.yaml | 4 ++ 6 files changed, 133 insertions(+) create mode 100644 releasenotes/notes/add-support-GlusterFS-NFS-Manila-backend-fa8a54e06adb0714.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 360117927f..d217e8efcb 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -642,6 +642,7 @@ enable_manila_backend_generic: "no" enable_manila_backend_hnas: "no" enable_manila_backend_cephfs_native: "no" enable_manila_backend_cephfs_nfs: "no" +enable_manila_backend_glusterfs_nfs: "no" enable_mariabackup: "no" enable_masakari: "no" enable_mistral: "no" diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index f5aafa017e..aa25523f26 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -167,6 +167,11 @@ manila_backends: protocols: - "NFS" - "CIFS" + - name: "glusterfsnfs1" + driver: "glusterfsnfs" + enabled: "{{ enable_manila_backend_glusterfs_nfs | bool }}" + protocols: + - "NFS" manila_enabled_backends: "{{ manila_backends|selectattr('enabled', 'equalto', true)|list }}" @@ -214,3 +219,11 @@ manila_ks_users: user: "{{ manila_keystone_user }}" password: "{{ manila_keystone_password }}" role: "admin" + +#################### +# Glusterfs +#################### +manila_glusterfs_share_layout: "layout_volume.GlusterfsVolumeMappedLayout" +manila_glusterfs_nfs_server_type: "Gluster" +manila_glusterfs_volume_pattern: "manila-share-volume-\\d+$" +manila_glusterfs_mount_point_base: "$state_path/mnt" diff --git a/ansible/roles/manila/templates/manila-share.conf.j2 b/ansible/roles/manila/templates/manila-share.conf.j2 index e0778d976b..51c946154f 100644 --- a/ansible/roles/manila/templates/manila-share.conf.j2 +++ b/ansible/roles/manila/templates/manila-share.conf.j2 @@ -117,3 +117,23 @@ cephfs_enable_snapshots = False cephfs_ganesha_server_is_remote= False cephfs_ganesha_server_ip = {{ api_interface_address }} {% endif %} + +{% if enable_manila_backend_glusterfs_nfs | bool %} +[glusterfsnfs1] +driver_handles_share_servers = False +share_backend_name = GLUSTERFSNFS1 +share_driver = manila.share.drivers.glusterfs.GlusterfsShareDriver +glusterfs_share_layout = {{ manila_glusterfs_share_layout }} +glusterfs_nfs_server_type = {{ manila_glusterfs_nfs_server_type }} +{% if manila_glusterfs_servers is defined %} +glusterfs_servers = {% for ip in manila_glusterfs_servers %}{% if manila_glusterfs_ssh_user is defined %}{{ manila_glusterfs_ssh_user }}@{% endif %}{{ ip }}{% if not loop.last %},{% endif %}{% endfor %} + +{% endif %} +{% if manila_glusterfs_volume_pattern is defined %}glusterfs_volume_pattern = {{ manila_glusterfs_volume_pattern }}{% endif %} + +{% if manila_glusterfs_target is defined %}glusterfs_target = {{ manila_glusterfs_target }}{% endif %} + +{% if manila_glusterfs_mount_point_base is defined %}glusterfs_mount_point_base = {{ manila_glusterfs_mount_point_base }}{% endif %} + +{% if manila_glusterfs_ssh_password is defined %}glusterfs_server_password = {{ manila_glusterfs_ssh_password }}{% endif %} +{% endif %} diff --git a/doc/source/reference/storage/manila-guide.rst b/doc/source/reference/storage/manila-guide.rst index 363848178e..11583e251b 100644 --- a/doc/source/reference/storage/manila-guide.rst +++ b/doc/source/reference/storage/manila-guide.rst @@ -361,3 +361,66 @@ migration process. For more information about how to manage shares, see the :manila-doc:`Manage shares `. + +GlusterFS +~~~~~~~~~ + +We have support for enabling Manila to provide users access to volumes from an +external GlusterFS. For more details on the GlusterfsShareDriver, please +see: +https://docs.openstack.org/manila/latest/admin/glusterfs_driver.html + +Kolla-ansible supports using the GlusterFS shares with NFS. To enable this +backend, add the following to ``/etc/kolla/globals.yml``: + +.. code-block:: console + + enable_manila_backend_glusterfs_nfs: "yes" + +Layouts +------- + +A layout is a strategy of allocating storage from GlusterFS backends for +shares. Currently there are two layouts implemented: + +volume mapped layout +-------------------- + +You will also need to add the following configuration options to ensure the +driver can connect to GlusterFS and exposes the correct subset of existing +volumes in the system by adding the following in ``/etc/kolla/globals.yml``: + +.. code-block:: console + + manila_glusterfs_servers: + - glusterfs1.example.com + - glusterfs2.example.com + manila_glusterfs_ssh_user: "root" + manila_glusterfs_ssh_password: "" + manila_glusterfs_volume_pattern: "manila-share-volume-\\d+$" + +The ``manila_glusterfs_ssh_password`` and ``manila_glusterfs_ssh_user`` +configuration options are only required when the GlusterFS server runs +remotely rather than on the system running the Manila share service. + +directory mapped layout +----------------------- + +You will also need to add the following configuration options to ensure the +driver can connect to GlusterFS and exposes the correct subset of existing +volumes in the system by adding the following in ``/etc/kolla/globals.yml``: + +.. code-block:: console + + manila_glusterfs_share_layout: "layout_directory.GlusterfsDirectoryMappedLayout" + manila_glusterfs_target: "root@10.0.0.1:/volume" + manila_glusterfs_ssh_password: "" + manila_glusterfs_mount_point_base: "$state_path/mnt" + +- ``manila_glusterfs_target``: If it’s of the format + @:/, then we ssh to + @ to execute gluster ( is supposed to + have administrative privileges on ). +- ``manila_glusterfs_ssh_password``: configuration options are only required + when the GlusterFS server runs remotely rather than on the system running + the Manila share service. diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 3a4ea5c17a..72371eab88 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -338,6 +338,7 @@ #enable_manila_backend_hnas: "no" #enable_manila_backend_cephfs_native: "no" #enable_manila_backend_cephfs_nfs: "no" +#enable_manila_backend_glusterfs_nfs: "no" #enable_mariabackup: "no" #enable_masakari: "no" #enable_mistral: "no" @@ -598,6 +599,37 @@ #hnas_evs_ip: #hnas_file_system_name: +# Gluster backend configuration +# The option of glusterfs share layout can be directory or volume +# The default option of share layout is 'volume' +#manila_glusterfs_share_layout: +# The default option of nfs server type is 'Gluster' +#manila_glusterfs_nfs_server_type: + +# Volume layout Options (required) +# If the glusterfs server requires remote ssh, then you need to fill +# in 'manila_glusterfs_servers', ssh user 'manila_glusterfs_ssh_user', and ssh password +# 'manila_glusterfs_ssh_password'. +# 'manila_glusterfs_servers' value List of GlusterFS servers which provide volumes, +# the format is for example: +# - 10.0.1.1 +# - 10.0.1.2 +#manila_glusterfs_servers: +#manila_glusterfs_ssh_user: +#manila_glusterfs_ssh_password: +# Used to filter GlusterFS volumes for share creation. +# Examples: manila-share-volume-\d+$, manila-share-volume-#{size}G-\d+$; +#manila_glusterfs_volume_pattern: + +# Directory layout Options +# If the glusterfs server is on the local node of the manila share, +# it’s of the format :/ +# If the glusterfs server is on a remote node, +# it’s of the format @:/ , +# and define 'manila_glusterfs_ssh_password' +#manila_glusterfs_target: +#manila_glusterfs_mount_point_base: + ################################ # Swift - Object Storage Options ################################ diff --git a/releasenotes/notes/add-support-GlusterFS-NFS-Manila-backend-fa8a54e06adb0714.yaml b/releasenotes/notes/add-support-GlusterFS-NFS-Manila-backend-fa8a54e06adb0714.yaml new file mode 100644 index 0000000000..69a77a999f --- /dev/null +++ b/releasenotes/notes/add-support-GlusterFS-NFS-Manila-backend-fa8a54e06adb0714.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Adds support for GlusterFS NFS Manila backend.