This section explains how to configure OpenStack Block
Storage to use NFS storage. You must be able to access the NFS
shares from the server that hosts the
cinder
volume service.
Note | |
---|---|
The
In Ubuntu and Debian distributions, the
|
Procedure 6.1. Configure Block Storage to use an NFS storage back end
Log in as
root
to the system hosting thecinder
volume service.Create a text file named
nfsshares
in/etc/cinder/
.Add an entry to
/etc/cinder/nfsshares
for each NFS share that thecinder
volume service should use for back end storage. Each entry should be a separate line, and should use the following format:HOST
:SHARE
Where:
HOST
is the IP address or host name of the NFS server.SHARE
is the absolute path to an existing and accessible NFS share.
Set
/etc/cinder/nfsshares
to be owned by theroot
user and thecinder
group:# chown root:cinder /etc/cinder/nfsshares
Set
/etc/cinder/nfsshares
to be readable by members of thecinder
group:# chmod 0640 /etc/cinder/nfsshares
Configure the
cinder
volume service to use the/etc/cinder/nfsshares
file created earlier. To do so, open the/etc/cinder/cinder.conf
configuration file and set thenfs_shares_config
configuration key to/etc/cinder/nfsshares
.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_shares_config /etc/cinder/nfsshares
The following distributions include openstack-config:
CentOS
Fedora
openSUSE
Red Hat Enterprise Linux
SUSE Linux Enterprise
Optionally, provide any additional NFS mount options required in your environment in the
nfs_mount_options
configuration key of/etc/cinder/cinder.conf
. If your NFS shares do not require any additional mount options (or if you are unsure), skip this step.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_mount_options
OPTIONS
Replace
OPTIONS
with the mount options to be used when accessing NFS shares. See the manual page for NFS for more information on available mount options (man nfs).Configure the
cinder
volume service to use the correct volume driver, namelycinder.volume.drivers.nfs.NfsDriver
. To do so, open the/etc/cinder/cinder.conf
configuration file and set thevolume_driver
configuration key tocinder.volume.drivers.nfs.NfsDriver
.On distributions that include openstack-config, you can configure this by running the following command instead:
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT volume_driver cinder.volume.drivers.nfs.NfsDriver
You can now restart the service to apply the configuration.
To restart the
cinder
volume service on CentOS, Fedora, openSUSE, Red Hat Enterprise Linux, or SUSE Linux Enterprise, run:# service openstack-cinder-volume restart
To restart the
cinder
volume service on Ubuntu or Debian, run:# service cinder-volume restart
Note | |
---|---|
The
Setting
However, should you choose to set
On distributions that include openstack-config, you can configure this by running the following command instead: # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT nfs_sparsed_volumes false |
Important | |
---|---|
If a client host has SELinux enabled, the
# setsebool -P virt_use_nfs on This command also makes the Boolean persistent across reboots. Run this command on all client hosts that require access to NFS volumes on an instance. This includes all Compute nodes. |