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
- On the Compute > Storage > External storages tab, click Add external storage.
- On the Protocol step, select the NFS protocol.
- On the NFS version step, choose between NFS 4.1 and NFS 3.
- 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.
- On the Summary step, review the configuration, and then click Add.
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.
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 themount
andnfs
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 toall
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 iscinder.volume.drivers.nfs.NfsDriver
.nfs_mount_options
tovers=4.1
andlookupcache=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
toFalse
to create volumes with open permissions.nfs_qcow2_volumes
toTrue
to create volumes as QCOW2 files.nfs_snapshot_support
toTrue
andnas_secure_file_operations
toFalse
to enable support for snapshots.nfs_sparsed_volumes
toTrue
to create volumes as sparsed files, which take no space.image_volume_cache_enabled
toFalse
to disable image-volume caching for the external storage.use_multipath_for_image_xfer
toTrue
for multipath setups.use_chap_auth
toFalse
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 | | | | | | +-------------+----------------------------------------------------+---------------+---------+------------+-----------+----------------------+