6.3. Configure the Block Storage Service
6.3.1. Configure the Block Storage Service Database Connection
/etc/cinder/cinder.conf
file. It must be updated to point to a valid database server before starting the service.
sql_connection
configuration key on each system hosting Block Storage services:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT sql_connection mysql://USER:PASS@IP/DB
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT sql_connection mysql://USER:PASS@IP/DB
- Replace USER with the Block Storage service database user name, usually
cinder
. - Replace PASS with the password of the database user.
- Replace IP with the IP address or host name of the server hosting the database service.
- Replace DB with the name of the Block Storage service database, usually
cinder
.
Important
6.3.2. Create the Block Storage Service Identity Records
services
tenant. For more information, see:
keystonerc_admin
file and on which the keystone command-line utility is installed.
Procedure 6.2. Creating Identity Records for the Block Storage Service
- Set up the shell to access Keystone as the administrative user:
source ~/keystonerc_admin
# source ~/keystonerc_admin
Copy to Clipboard Copied! - Create the
cinder
user:[(keystone_admin)]# keystone user-create --name cinder --pass PASSWORD +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | email | | | enabled | True | | id | e1765f70da1b4432b54ced060139b46a | | name | cinder | | username | cinder | +----------+----------------------------------+
[(keystone_admin)]# keystone user-create --name cinder --pass PASSWORD +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | email | | | enabled | True | | id | e1765f70da1b4432b54ced060139b46a | | name | cinder | | username | cinder | +----------+----------------------------------+
Copy to Clipboard Copied! Replace PASSWORD with a secure password that will be used by the Block Storage service when authenticating with the Identity service. - Link the
cinder
user and theadmin
role together within the context of theservices
tenant:[(keystone_admin)]# keystone user-role-add --user cinder --role admin --tenant services
[(keystone_admin)]# keystone user-role-add --user cinder --role admin --tenant services
Copy to Clipboard Copied! - Create the
cinder
andcinderv2
Block Storage service entries:[(keystone_admin)]# keystone service-create --name cinder \ --type volume \ --description "Cinder Volume Service" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Cinder Volume Service | | enabled | True | | id | dfde7878671e484c9e581a3eb9b63e66 | | name | cinder | | type | volume | +-------------+----------------------------------+
[(keystone_admin)]# keystone service-create --name cinder \ --type volume \ --description "Cinder Volume Service" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Cinder Volume Service | | enabled | True | | id | dfde7878671e484c9e581a3eb9b63e66 | | name | cinder | | type | volume | +-------------+----------------------------------+
Copy to Clipboard Copied! [(keystone_admin)]# keystone service-create --name cinderv2 \ --type volumev2 \ --description "Cinder Volume Service v2" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Cinder Volume Service v2 | | enabled | True | | id | 42318fdec1926f57643ca7b1e40b78df | | name | cinderv2 | | type | volumev2 | +-------------+----------------------------------+
[(keystone_admin)]# keystone service-create --name cinderv2 \ --type volumev2 \ --description "Cinder Volume Service v2" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Cinder Volume Service v2 | | enabled | True | | id | 42318fdec1926f57643ca7b1e40b78df | | name | cinderv2 | | type | volumev2 | +-------------+----------------------------------+
Copy to Clipboard Copied! - Create the
cinder
endpoint entry:[(keystone_admin)]# keystone endpoint-create \ --service cinder \ --publicurl 'http://IP:8776/v1/%(tenant_id)s' \ --adminurl 'http://IP:8776/v1/%(tenant_id)s' \ --internalurl 'http://IP:8776/v1/%(tenant_id)s' \ --region 'RegionOne'
[(keystone_admin)]# keystone endpoint-create \ --service cinder \ --publicurl 'http://IP:8776/v1/%(tenant_id)s' \ --adminurl 'http://IP:8776/v1/%(tenant_id)s' \ --internalurl 'http://IP:8776/v1/%(tenant_id)s' \ --region 'RegionOne'
Copy to Clipboard Copied! [(keystone_admin)]# keystone endpoint-create \ --service cinderv2 \ --publicurl 'http://IP:8776/v2/%(tenant_id)s' \ --adminurl 'http://IP:8776/v2/%(tenant_id)s' \ --internalurl 'http://IP:8776/v2/%(tenant_id)s' --region 'RegionOne'
[(keystone_admin)]# keystone endpoint-create \ --service cinderv2 \ --publicurl 'http://IP:8776/v2/%(tenant_id)s' \ --adminurl 'http://IP:8776/v2/%(tenant_id)s' \ --internalurl 'http://IP:8776/v2/%(tenant_id)s' --region 'RegionOne'
Copy to Clipboard Copied! Replace IP with the IP address or host name of the server hosting the Block Storage API service (openstack-cinder-api
). To install and run multiple instances of the API service, repeat this step for the IP address or host name of each instance.
6.3.3. Configure Block Storage Service Authentication
root
user.
Procedure 6.3. Configuring the Block Storage Service to Authenticate Through the Identity Service
- Set the authentication strategy to
keystone
:openstack-config --set /etc/cinder/cinder.conf \ DEFAULT auth_strategy keystone
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT auth_strategy keystone
Copy to Clipboard Copied! - Set the Identity service host that the Block Storage services must use:
openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken auth_host IP
# openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken auth_host IP
Copy to Clipboard Copied! Replace IP with the IP address or host name of the server hosting the Identity service. - Set the Block Storage services to authenticate as the correct tenant:
openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_tenant_name services
# openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_tenant_name services
Copy to Clipboard Copied! Replace services with the name of the tenant created for the use of OpenStack Networking. Examples in this guide useservices
. - Set the Block Storage services to authenticate using the
cinder
administrative user account:openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_user cinder
# openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_user cinder
Copy to Clipboard Copied! - Set the Block Storage services to use the correct
cinder
administrative user account password:openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_password PASSWORD
# openstack-config --set /etc/cinder/cinder.conf \ keystone_authtoken admin_password PASSWORD
Copy to Clipboard Copied! Replace PASSWORD with the password set when thecinder
user was created.
6.3.4. Configure the Firewall to Allow Block Storage Service Traffic
root
user.
Procedure 6.4. Configuring the Firewall to Allow Block Storage Service Traffic
- Open the
/etc/sysconfig/iptables
file in a text editor. - Add an INPUT rule allowing TCP traffic on ports
3260
and8776
to the file. The new rule must appear before any INPUT rules that REJECT traffic:-A INPUT -p tcp -m multiport --dports 3260,8776 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 3260,8776 -j ACCEPT
Copy to Clipboard Copied! - Save the changes to the
/etc/sysconfig/iptables
file. - Restart the
iptables
service to ensure that the change takes effect:systemctl restart iptables.service
# systemctl restart iptables.service
Copy to Clipboard Copied!
6.3.5. Configure the Block Storage Service to Use SSL
cinder.conf
file to configure SSL.
Configuration Option | Description |
---|---|
backlog
|
The number of backlog requests with which to configure the socket.
|
tcp_keepidle
|
Sets the value of TCP_KEEPIDLE in seconds for each server socket.
|
ssl_ca_file
|
The CA certificate file to use to verify connecting clients.
|
ssl_cert_file
|
The certificate file to use when starting the server securely.
|
ssl_key_file
|
The private key file to use when starting the server securely.
|
6.3.6. Configure RabbitMQ Message Broker Settings for the Block Storage Service
root
user.
Procedure 6.5. Configuring the Block Storage Service to use the RabbitMQ Message Broker
- Set RabbitMQ as the RPC back end:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu
Copy to Clipboard Copied! - Set the name of the RabbitMQ host:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_host RABBITMQ_HOST
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_host RABBITMQ_HOST
Copy to Clipboard Copied! Replace RABBITMQ_HOST with the IP address or host name of the message broker. - Set the message broker port to
5672
:openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_port 5672
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_port 5672
Copy to Clipboard Copied! - Set the RabbitMQ username and password created for the Block Storage service when RabbitMQ was configured:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_userid cinder
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_userid cinder
Copy to Clipboard Copied! openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_password CINDER_PASS
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_password CINDER_PASS
Copy to Clipboard Copied! Replacecinder
and CINDER_PASS with the RabbitMQ user name and password created for the Block Storage service. - When RabbitMQ was launched, the
cinder
user was granted read and write permissions to all resources: specifically, through the virtual host/
. Configure the Block Storage service to connect to this virtual host:openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_virtual_host /
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_virtual_host /
Copy to Clipboard Copied!
6.3.7. Enable SSL Communication Between the Block Storage Service and the Message Broker
- Enable SSL communication with the message broker:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_use_ssl True openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_certfile /path/to/client.crt openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_keyfile /path/to/clientkeyfile.key
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rabbit_use_ssl True # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_certfile /path/to/client.crt # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_keyfile /path/to/clientkeyfile.key
Copy to Clipboard Copied! Replace the following values:- Replace /path/to/client.crt with the absolute path to the exported client certificate.
- Replace /path/to/clientkeyfile.key with the absolute path to the exported client key file.
- If your certificates were signed by a third-party Certificate Authority (CA), you must also run the following command:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_ca_certs /path/to/ca.crt
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT kombu_ssl_ca_certs /path/to/ca.crt
Copy to Clipboard Copied! Replace /path/to/ca.crt with the absolute path to the CA file provided by the third-party CA (see Section 2.3.4, “Enable SSL on the RabbitMQ Message Broker” for more information).
6.3.8. Populate the Block Storage Database
Important
Procedure 6.6. Populating the Block Storage Service Database
- Log in to the system hosting one of the Block Storage services.
- Switch to the
cinder
user:su cinder -s /bin/sh
# su cinder -s /bin/sh
Copy to Clipboard Copied! - Initialize and populate the database identified in
/etc/cinder/cinder.conf
:cinder-manage db sync
$ cinder-manage db sync
Copy to Clipboard Copied!
6.3.9. Increase the Throughput of the Block Storage API Service
openstack-cinder-api
) runs in one process. This limits the number of API requests that the Block Storage service can process at any given time. In a production environment, you should increase the Block Storage API throughput by allowing openstack-cinder-api
to run in as many processes as the machine capacity allows.
osapi_volume_workers
, allows you to specify the number of API service workers (or OS processes) to launch for openstack-cinder-api
.
openstack-cinder-api
host:
openstack-config --set /etc/cinder/cinder.conf \ DEFAULT osapi_volume_workers CORES
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT osapi_volume_workers CORES