Implement NFS multi backend support

The NFS implementation based off cinder_nfs_client
does not support per cinder backend configuration,
separating NFS mounts per backend.
This fix removes cinder_nfs_client in favor of
fully supporting multi cinder backends over the
cinder_backends stanza.

Closes-Bug #1657203

Change-Id: I817ff372c2d58e999a89496fce3d25dc617216f0
This commit is contained in:
Bjoern Teipel 2017-01-17 15:54:19 -06:00 committed by Alexandra Settle
parent d14410b70d
commit e6c2b14c71
6 changed files with 60 additions and 30 deletions

View File

@ -205,16 +205,6 @@ cinder_quota_backup_gigabytes: 1000
# cinder_backend_lvm_inuse: True if current host has an lvm backend
cinder_backend_lvm_inuse: '{{ (cinder_backends|default("")|to_json).find("lvm") != -1 }}'
## Define nfs information for cinder. When the cinder_nfs_client dictionary is defined,
## it will enable nfs shares. The value ``nfs_shares_config`` is the path on the disk
## where the NFS export will live. The ``shares`` value is a list of dictionaries that
## must have the IP address of the NFS server and the location where the export will be.
# cinder_nfs_client:
# nfs_shares_config: /etc/cinder/nfs_shares
# shares:
# - ip: "127.0.0.1"
# share: "/vol/cinder"
## Policy vars
# Provide a list of access controls to update the default policy.json with. These changes will be merged
# with the access controls in the default policy.json. E.g.

View File

@ -30,15 +30,29 @@ Edit ``/etc/openstack_deploy/openstack_user_config.yml`` and configure
the NFS client on each storage node if the NetApp backend is configured to use
an NFS storage protocol.
#. Add the ``cinder_backends`` stanza (which includes
``cinder_nfs_client``) under the ``container_vars`` stanza for
each storage node:
#. For each storage node, add one ``cinder_backends`` block underneath
the a new ``container_vars`` section. ``container_vars`` are used to
allow container/host individualized configuration. Each cinder back end
is defined with a unique key. For example, ``nfs-volume1``.
This later represents a unique cinder backend and volume type.
.. code-block:: yaml
container_vars:
cinder_backends:
cinder_nfs_client:
nfs-volume1:
#. Configure the appropriate cinder volume backend name:
.. code::
volume_backend_name: NFS_VOLUME1
#. Configure the appropriate cinder NFS driver:
.. code::
volume_driver: cinder.volume.drivers.nfs.NfsDriver
#. Configure the location of the file that lists shares available to the
block storage service. This configuration file must include
@ -46,21 +60,43 @@ an NFS storage protocol.
.. code-block:: yaml
nfs_shares_config: SHARE_CONFIG
nfs_shares_config: FILENAME_NFS_SHARES
Replace ``SHARE_CONFIG`` with the location of the share
configuration file. For example, ``/etc/cinder/nfs_shares``.
Replace ``FILENAME_NFS_SHARES`` with the location of the share
configuration file. For example, ``/etc/cinder/nfs_shares_volume1``.
#. Define mount options for the NFS mount. For example:
.. code::
nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120"
#. Configure one or more NFS shares:
.. code-block:: yaml
shares:
- { ip: "NFS_HOST", share: "NFS_SHARE" }
- { ip: "HOSTNAME", share: "PATH_TO_NFS_VOLUME" }
Replace ``NFS_HOST`` with the IP address or hostname of the NFS
server, and the ``NFS_SHARE`` with the absolute path to an existing
and accessible NFS share.
Replace ``HOSTNAME`` with the IP address or hostname of the NFS
server, and the ``PATH_TO_NFS_VOLUME`` with the absolute path to an
existing and accessible NFS share (excluding the IP address or hostname).
The following is a full configuration example of a cinder NFS backend
named NFS1. The cinder playbooks will automatically add a custom
``volume-type`` and ``nfs-volume1`` as in this example:
.. code::
container_vars:
cinder_backends:
nfs-volume1:
volume_backend_name: NFS_VOLUME1
volume_driver: cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config: /etc/cinder/nfs_shares_volume1
nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120"
shares:
- { ip: "1.2.3.4", share: "/vol1" }
Backup
~~~~~~
@ -407,9 +443,9 @@ each storage node that will use it.
.. code-block:: yaml
nfs_shares_config: SHARE_CONFIG
nfs_shares_config: FILENAME_NFS_SHARES
Replace ``SHARE_CONFIG`` with the location of the share
Replace ``FILENAME_NFS_SHARES`` with the location of the share
configuration file. For example, ``/etc/cinder/nfs_shares``.
#. Configure the server:

View File

@ -0,0 +1,5 @@
---
upgrade:
- The global override ``cinder_nfs_client`` is replaced
in favor of fully supporting multi backends
configuration via the cinder_backends stanza.

View File

@ -68,10 +68,13 @@
- name: Create nfs shares export file
template:
src: nfs_shares.j2
dest: "{{ cinder_nfs_client.nfs_shares_config }}"
dest: "{{ item.value.nfs_shares_config }}"
with_dict: "{{ cinder_backends }}"
when:
- cinder_nfs_client is defined
- item.value.nfs_shares_config is defined
- inventory_hostname in groups['cinder_volume']
tags:
- cinder-nfs
- name: Drop sudoers file
template:

View File

@ -102,9 +102,6 @@ enabled_backends={% for backend in cinder_backends|dictsort %}{{ backend.0 }}{%
{% for key, value in backend_section.1.items() if key != 'extra_volume_types' %}
{{ key }}={{ value }}
{% endfor %}
{% if cinder_nfs_client is defined %}
nfs_shares_config={{ cinder_nfs_client.nfs_shares_config }}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -1,5 +1,4 @@
# {{ ansible_managed }}
{% for share in cinder_nfs_client.shares %}
{% for share in item.value.shares %}
{{ share.ip }}:{{ share.share }}
{% endfor %}