Installing and configuring Block Storage
Install the packages for OpenStack Block Storage on the cloud controller.
# apt-get install cinder-api cinder-scheduler cinder-volume
# yum install openstack-cinder openstack-utils openstack-selinux
# zypper install openstack-cinder-api openstack-cinder-scheduler \
openstack-cinder-volume
If you are using XenServer type vhd images, you will also need the vhd-util
binary to be able to create volumes from uploaded images.
This could be installed by:
# apt-get install blktap-utils
# zypper in xen-tools
# yum install blktap
Edit /etc/cinder/api-paste.ini (filter
authtoken).[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
service_protocol = http
service_host = 192.168.206.130
service_port = 5000
auth_host = 192.168.206.130
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = cinder
admin_password = openstack
Edit /etc/cinder/cinder.conf to reflect your settings.
[DEFAULT]
rootwrap_config=/etc/cinder/rootwrap.conf
sql_connection = mysql://cinder:openstack@localhost/cinder
api_paste_config = /etc/cinder/api-paste.ini
iscsi_helper=tgtadm
volume_name_template = volume-%s
volume_group = cinder-volumes
verbose = True
auth_strategy = keystone
#osapi_volume_listen_port=5900
Configure messaging also in /etc/cinder/cinder.conf.
rabbit_host = 10.10.10.10
rabbit_port = 5672
# Change the following settings if you're not using the default RabbitMQ configuration
#rabbit_userid = rabbit
#rabbit_password = secure_password
#rabbit_virtual_host = /nova
qpid_hostname=192.168.206.130
rabbit_host = 10.10.10.10
rabbit_port = 5672
# Change the following settings if you're not using the default RabbitMQ configuration
#rabbit_userid = rabbit
#rabbit_password = secure_password
#rabbit_virtual_host = /nova
Verify entries in /etc/nova/nova.conf. The
volume_api_class setting is the default setting since
grizzly.
volume_api_class=nova.volume.cinder.API
Set up the cinder database.
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Add a filter entry to the devices section
/etc/lvm/lvm.conf to keep LVM from scanning devices
used by virtual machines.
You must add every physical volume that is
needed for LVM on the Cinder host. You can get a list by running
pvdisplay.
Each item in the filter array starts with either an
"a" for accept, or an "r" for reject.
Physical volumes that are needed on the Cinder host begin with
"a". The array must end with
"r/.*/"
devices {
...
filter = [ "a/sda1/", "a/sdb1/", "r/.*/"]
...
}
Set up the target file.
$state_path=/var/lib/cinder/ and
$volumes_dir=$state_path/volumes are the
default values used by the Block Storage service.
These directories MUST exist!
$ sudo sh -c "echo 'include /var/lib/cinder/volumes/*' >> /etc/tgt/targets.conf"
Restart the tgt service.
$ sudo restart tgt
Populate the database.
$ sudo cinder-manage db sync
Restart the services.
$ sudo service cinder-volume restart
$ sudo service cinder-api restart
$ sudo service cinder-scheduler restart
Create a 1 GB test volume.
$ cinder create --display_name test 1
$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| 5bbad3f9-50ad-42c5-b58c-9b6b63ef3532 | available | test | 1 | None | |
+--------------------------------------+-----------+--------------+------+-------------+-------------+