9. Add the Block Storage service

Block Storage Server:

1. sudo apt-get install python-mysqldb
 
2. sudo apt-get install lvm2
 
3. 创建存储卷
sudo pvcreate /dev/sdb
sudo vgcreate cinder-volumes /dev/sdb
 
4. sudo vi /etc/lvm/lvm.conf
filter = [ "a/sda1/", "a/sdb/", "r/.*/"]
 
5. sudo apt-get install cinder-volume
 
6. sudo vi /etc/cinder/cinder.conf
[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
[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = RABBIT_PASS
[database]
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
[DEFAULT]
glance_host = controller
 
7. sudo service cinder-volume restart && sudo service tgt restart
 
Controller Node:
1. sudo apt-get install cinder-api cinder-scheduler
 
2. sudo vi /etc/cinder/cinder.conf
[database]
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
 
3. 创建数据库
mysql -u root -p
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
 
4. sudo -s /bin/sh -c "cinder-manage db sync" cinder
 
5. 创建用户
source admin-openrc.sh
keystone user-create --name=cinder --pass=CINDER_PASS --email=cinder@example.com
keystone user-role-add --user=cinder --tenant=service --role=admin
 
6. sudo vi /etc/cinder/cinder.conf
[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
[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = RABBIT_PASS
 
7. 
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
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
 
8. sudo service cinder-scheduler restart && sudo service cinder-api restart
 
Verify:
1. source demo-openrc.sh
 
2. cinder create --display-name myVolume 1
 
3. cinder list
posted @ 2015-05-09 09:29  dongdonggeorge  阅读(222)  评论(0编辑  收藏  举报