Configure a Block Storage service controller
This scenario configures OpenStack Block Storage
services on the Controller node
and assumes that a
second node provides storage through the cinder-volume service.
For
instructions on how to configure the second node, see .
You can configure OpenStack to use various storage systems.
This example uses LVM.
Install the appropriate packages for the Block Storage
service:
# apt-get install cinder-api cinder-scheduler
# yum install openstack-cinder
# zypper install openstack-cinder-api openstack-cinder-scheduler
Respond to the prompts for database
management, [keystone_authtoken] settings, RabbitMQ credentials and API endpoint registration.
Configure Block Storage to use your database.
Run the following command
to set connection option in the
[database] section, which is in the
/etc/cinder/cinder.conf file, replace
CINDER_DBPASS with the password for the
Block Storage database that you will create in a later step:
In the /etc/cinder/cinder.conf
file, set the connection option in the
[database] section and replace
CINDER_DBPASS with the password for the
Block Storage database that you will create in a later step:
# openstack-config --set /etc/cinder/cinder.conf \
database connection mysql://cinder:CINDER_DBPASS@controller/cinder
[database]
...
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
In some distributions, the /etc/cinder/cinder.conf
file does not include the
[database] section header. You must add this
section header to the end of the file before you proceed.
Use the password that you set to log in as root to create
a cinder database:
# mysql -u root -p
mysql> CREATE DATABASE cinder;
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'CINDER_DBPASS';
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'CINDER_DBPASS';
Create the database tables for the Block Storage
service:
# su -s /bin/sh -c "cinder-manage db sync" cinder
Create a cinder user.
The Block Storage service uses this user to authenticate
with the Identity service.
Use the service tenant and give the
user the admin role:
$ keystone user-create --name=cinder --pass=CINDER_PASS --email=cinder@example.com
$ keystone user-role-add --user=cinder --tenant=service --role=admin
Edit the
/etc/cinder/cinder.conf configuration file:
# openstack-config --set /etc/cinder/cinder.conf DEFAULT \
auth_strategy keystone
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
auth_uri http://controller:5000
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
auth_host controller
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
auth_protocol http
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
auth_port 35357
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
admin_user cinder
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
admin_tenant_name service
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \
admin_password CINDER_PASS
Edit the
/etc/cinder/cinder.conf configuration
file and add this section for keystone credentials:
...
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host = controller
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = cinder
admin_password = CINDER_PASS
Configure Block Storage to use the RabbitMQ message
broker.
In the [DEFAULT] section in
the /etc/cinder/cinder.conf file, set
these configuration keys and replace
RABBIT_PASS with the password you
chose for RabbitMQ:
[DEFAULT]
...
rpc_backend = cinder.openstack.common.rpc.impl_kombu
rabbit_host = controller
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = RABBIT_PASS
Configure Block Storage to use the Qpid message
broker:
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT qpid_hostname controller
Configure Block Storage to use the RabbitMQ message
broker.
Replace RABBIT_PASS with the
password you chose for RabbitMQ:
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_host controller
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_port 5672
# openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_password RABBIT_PASS
Register the Block Storage service with the Identity
service so that other OpenStack services can locate it:
$ keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"
$ keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ volume / {print $2}') \
--publicurl=http://controller:8776/v1/%\(tenant_id\)s \
--internalurl=http://controller:8776/v1/%\(tenant_id\)s \
--adminurl=http://controller:8776/v1/%\(tenant_id\)s
Register a service and endpoint for version 2 of the Block
Storage service API:
$ keystone service-create --name=cinderv2 --type=volumev2 --description="OpenStack Block Storage v2"
$ keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ volumev2 / {print $2}') \
--publicurl=http://controller:8776/v2/%\(tenant_id\)s \
--internalurl=http://controller:8776/v2/%\(tenant_id\)s \
--adminurl=http://controller:8776/v2/%\(tenant_id\)s
Restart the Block Storage services with the new
settings:
# service cinder-scheduler restart
# service cinder-api restart
Start and configure the Block Storage services to start when
the system boots:
# service openstack-cinder-api start
# service openstack-cinder-scheduler start
# chkconfig openstack-cinder-api on
# chkconfig openstack-cinder-scheduler on