Attaching external NFS storage

The Generic NFS Reference Driver allows you to mount multiple NFS shares to your compute cluster and use them as external NFS storages.

Once you connect external storage to the compute cluster, you can start using it by creating storage policies and applying them on VM volumes.

To attach an external NFS storage

Admin panel

  1. On the Compute > Storage > External storages tab, click Add external storage.
  2. On the Protocol step, select the NFS protocol.
  3. On the NFS version step, choose between NFS 4.1 and NFS 3.
  4. On the Name and configuration step, specify a name for your external storage, the management IP address or DNS name, and the root export path of your NFS share.
  5. Ensure that the specified data is valid. Incorrectly configuring the storage will result in a critical state of the corresponding cinder-volume service for that storage. Other services, including cinder-volume services for different storage systems, will remain unaffected.

  6. On the Summary step, review the configuration, and then click Add.

Command-line interface

Use the following command:

vinfra service compute storage add <storage_name> --nfs --params nas_host=<nas_ip_address>,nas_share_path=<share_path>
                                   [--nfs-mount-options <options>] --enable
<storage_name>
Custom name of your external storage. The name may only contain letters, numbers, and underscores, and must be 3 to 64 characters long.
nas_host=<nas_ip_address>
IP address of the external storage to connect to.
nas_share_path=<share_path>
Root export path of the NFS share.
--nfs-mount-options <options>

A comma-separated list of mount options for NFS compute storages, with additional flags separated by spaces. For example: lookupcache=none,nfsvers=4,minorversion=0,timeo=150,retrans=3 -m -s. To see a full list of mount options, refer to the mount and nfs man pages.

Note that if nfs_shares_config is used, these mount options are applied to every share listed in the configuration file, unless they are overwritten in the configuration file.

Setting the lookupcache policy to all is not recommended as it leads to issues with accessing volume .info files.

When the --nfs option is specified, it automatically sets the following parameters required for NFS storage:

  • volume_backend_name to the external storage name specified by <storage_name>.
  • volume_driver to the name of the OpenStack volume driver, which is cinder.volume.drivers.nfs.NfsDriver.
  • nfs_mount_options to vers=4.1 and lookupcache=pos to use NFS version 4.1 and ensure that the NFS client revalidates negative entries in the directory entry cache.
  • nfs_mount_point_base to the directory to mount the NFS share to, which is /mnt/compute/storages.
  • nas_secure_file_permissions to False to create volumes with open permissions.
  • nfs_qcow2_volumes to True to create volumes as QCOW2 files.
  • nfs_snapshot_support to True and nas_secure_file_operations to False to enable support for snapshots.
  • nfs_sparsed_volumes to True to create volumes as sparsed files, which take no space.
  • image_volume_cache_enabled to False to disable image-volume caching for the external storage.
  • use_multipath_for_image_xfer to True for multipath setups.
  • use_chap_auth to False to disable CHAP authentication.

For example, to add the external storage nfs_storage with the IP address 10.10.10.12 and the share path /myshare, run:

# vinfra service compute storage add nfs_storage --nfs --params nas_host=10.10.10.12,nas_share_path=/myshare --enable

Ensure that the specified data is valid. Incorrectly configuring the storage will result in a critical state of the corresponding cinder-volume service for that storage. Other services, including cinder-volume services for different storage systems, will remain unaffected.

The added external storage will appear in the vinfra service compute storage list output:

# vinfra service compute storage list
+-------------+----------------------------------------------------+---------------+---------+------------+-----------+----------------------+
| name        | params                                             | secret_params | enabled | configured | status    | statistics           |
+-------------+----------------------------------------------------+---------------+---------+------------+-----------+----------------------+
| nfs_storage | driver_ssl_cert_verify: false                      |               | True    | True       | available | total_capacity: 10.0 |
|             | image_volume_cache_enabled: false                  |               |         |            |           | used_capacity: 0.0   |
|             | nas_host: 10.136.18.140                            |               |         |            |           |                      |
|             | nas_secure_file_operations: 'False'                |               |         |            |           |                      |
|             | nas_secure_file_permissions: 'False'               |               |         |            |           |                      |
|             | nas_share_path: /share1                            |               |         |            |           |                      |
|             | nfs_mount_options: lookupcache=pos                 |               |         |            |           |                      |
|             | nfs_mount_point_base: /mnt/compute/storages        |               |         |            |           |                      |
|             | nfs_qcow2_volumes: true                            |               |         |            |           |                      |
|             | nfs_snapshot_support: true                         |               |         |            |           |                      |
|             | nfs_sparsed_volumes: true                          |               |         |            |           |                      |
|             | use_chap_auth: false                               |               |         |            |           |                      |
|             | use_multipath_for_image_xfer: true                 |               |         |            |           |                      |
|             | volume_backend_name: nfs_storage                   |               |         |            |           |                      |
|             | volume_driver: cinder.volume.drivers.nfs.NfsDriver |               |         |            |           |                      |
+-------------+----------------------------------------------------+---------------+---------+------------+-----------+----------------------+