Mindmajix

Configuring OpenStack Compute for Cinder volume

We now need to tell our OpenStack Compute service about our new Cinder volume service.

Getting ready

As we are performing this setup in a multi-node environment, you will need to be logged into your controller, compute, and Cinder nodes.

This recipe assumes that you have created a .stackrc file. To create a .stackrc file, on each node you need it, open a text file .stackrc and add the following contents:

export OS_TENANT_NAME=cookbook 
export OS_USERNAME=admin
 export OS_PASSWORD=openstack
export OS_AUTH_URL=http://172.16.0.200:5000/v2.0/

How to accomplish it…

In our multi-node installation, we will need to configure the controller, compute, and Cinder nodes. Thus, we have broken down the instructions in that order.

To configure your OpenStack controller node for the cinder-volume perform the following steps:

  • In our multi-node configuration, the OpenStack controller is responsible for authentication (keystone) as well as hosting the Cinder database. First, we will configure authentication:
vagrant ssh controller
 sudo su -
source .stackrc
keystone service-create --name volume --type volume --description 'Volume Service'
# Cinder Block Storage Service
CINDER_SERVICE_ID=$(keystone service-list | awk '/\ volume\ / {print $2}')
CINDER_ENDPOINT="172.16.0.211"
PUBLIC="http://$CINDER_ENDPOINT:8776/v1/%(tenant_id)s"
ADMIN=$PUBLIC
INTERNAL=$PUBLIC
keystone endpoint-create --region RegionOne --service_id $CINDER_SERVICE_ID --publicurl $PUBLIC --adminurl $ADMIN -- internalurl $INTERNAL
keystone user-create --name cinder --pass cinder --tenant_id $SERVICE_TENANT_ID --email cinder@localhost --enabled true
CINDER_USER_ID=$(keystone user-list | awk '/\ cinder \ / {print $2}')
keystone user-role-add --user $CINDER_USER_ID --role $ADMIN_ROLE_ID --tenant_id $SERVICE_TENANT_ID

Next, we create the MySQL database for use with Cinder:

MYSQL_ROOT_PASS=openstack
MYSQL_CINDER_PASS=openstack
mysql -uroot -p$MYSQL_ROOT_PASS -e 'CREATE DATABASE cinder;'
mysql -uroot -p$MYSQL_ROOT_PASS -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%';"
mysql -uroot -p$MYSQL_ROOT_PASS -e "SET PASSWORD FOR 'cinder'@'%'
= PASSWORD('$MYSQL_CINDER_PASS');"
  • Finally, we edit conf to make the controller node aware of Cinder:
vim /etc/nova/nova.conf
  • Add the following lines:
volume_driver=nova.volume.driver.ISCSIDriver
enabled_apis=ec2,osapi_compute,metadata
volume_api_class=nova.volume.cinder.API
iscsi_helper=tgtadm
  • Now restart the nova services:
for P in $(ls /etc/init/nova* | cut -d'/' -f4 | cut -d'.' -f1)
do
sudo stop ${P}
sudo start ${P}
done

To configure the OpenStack compute nodes for Cinder, perform the following steps:

  • Next on our list for configuration are the OpenStack compute nodes. In our scenario, there is only a single compute node to configure:
vagrant ssh compute sudo su -

Now, edit nova.conf

vim /etc/nova/nova.conf
  • Add the following lines:
volume_driver=nova.volume.driver.ISCSIDriver
enabled_apis=ec2,osapi_compute,metadata
volume_api_class=nova.volume.cinder.API
iscsi_helper=tgtadm
  • Now restart the nova services:
for P in $(ls /etc/init/nova* | cut -d'/' -f4 | cut -d'.' -f1)
do
sudo stop ${P}
sudo start ${P}
done

To configure the Cinder node for use with cinder-volume perform the following steps: 1. Run the following commands:

vagrant ssh cinder sudo su -
  • First, we modify /etc/Cinder/api-paste.ini to enable keystone as follows:
sudo sed -i 's/127.0.0.1/'172.16.0.200'/g' /etc/cinder/api-
paste.ini
sudo sed -i 's/%SERVICE_TENANT_NAME%/service/g' /etc/cinder/api-
paste.ini
sudo sed -i 's/%SERVICE_USER%/Cinder/g' /etc/cinder/api-
paste.ini
sudo sed -i 's/%SERVICE_PASSWORD%/Cinder/g' /etc/cinder/api-
paste.ini
  • Next, we modify /etc/cinder/cinder.conf to configure the database, iSCSI, and RabbitMQ. Ensure conf has the following lines:
[DEFAULT]
rootwrap_config=/etc/cinder/rootwrap.conf
sql_connection = mysql://cinder:openstack@${CONTROLLER_HOST}/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
# Add these when not using the defaults.
rabbit_host = ${CONTROLLER_HOST}
rabbit_port = 5672
state_path = /var/lib/cinder/
  • To wrap up, we populate the Cinder database and restart the Cinder services:
cinder-manage db sync
cd /etc/init.d/; for i in $( ls cinder-* ); do sudo service $i restart; done

How it works…

In our multi-node OpenStack configuration, we have to perform configuration across our environment to enable cinder-volume. On the OpenStack controller node, we created a keystone service, endpoint, and user. We additionally assigned the “Cinder” user, the admin role within the service tenant. Additionally, on the controller, we created a Cinder MySQL database and modified nova.conf to allow the use of Cinder.

On our compute nodes, the modifications were much simpler as we only needed to modify nova.conf to enable Cinder.

Finally, we configured the Cinder node itself. We did this by enabling keystone and initializing the Cinder database, and connecting the Cinder service to its MySQL database. After which we wrapped up by restarting the Cinder services.

http://docs.openstack.org/kilo/config-reference/content/section_cinder.conf.html


 

0 Responses on Configuring OpenStack Compute for Cinder volume"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.