配置Cinder块设备存储

安装cinder组件

1
yum install openstack-cinder -y

备份cinder配置文件
1
mv /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak

创建cinder配置文件
vi /etc/cinder/cinder.conf

注意rbd_secret_uuid为前面实际创建的值,笔者的环境中是: AQCEWRpVGDOsCBAAuGIEzp/FkCc6KPQSaFGAbw==

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[DEFAULT]
auth_strategy = keystone
rpc_backend = cinder.openstack.common.rpc.impl_qpid
qpid_hostname = controller
volume_driver=cinder.volume.drivers.rbd.RBDDriver
rbd_pool=volumes
rbd_ceph_conf=/etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot=false
rbd_max_clone_depth=5
glance_api_version=2
rbd_user=volumes
rbd_secret_uuid= AQDEgllUyAslLxAAvExrAIZWzUOPHQk6M7GUgg==
[BRCD_FABRIC_EXAMPLE]
[database]
connection = mysql://cinder:CINDER_DBPASS@controller/cinder
[fc-zone-manager]
[keymgr]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host = controller
auth_protocol = http
auth_port = 35357
admin_user = cinder
admin_tenant_name = service
admin_password = CINDER_PASS
[matchmaker_ring]
[ssl]

修改cinder配置文件权限

1
chown -R root:cinder /etc/cinder/cinder.conf

同步导入cinder数据库表
1
su -s /bin/sh -c "cinder-manage db sync" cinder

创建cinder用户、角色、端点服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
keystone user-create --name=cinder --pass=CINDER_PASS --email=cinder@example.com
keystone user-role-add --user=cinder --tenant=service --role=admin
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

修改volumes的cephx密钥权限
1
chown -R cinder:cinder /etc/ceph/ceph.client.volumes.keyring

启动cinder相关服务
1
2
3
4
5
6
service openstack-cinder-api start
service openstack-cinder-scheduler start
service openstack-cinder-volume start
chkconfig openstack-cinder-api on
chkconfig openstack-cinder-scheduler on
chkconfig openstack-cinder-volume on

Cinder创建volume硬盘卷验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@controller ~]# cinder create --display-name test 1
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2015-04-02T03:43:16.194522 |
| display_description | None |
| display_name | test |
| encrypted | False |
| id | d6b816e1-1dcc-4f37-9bad-9d3581834233 |
| metadata | {} |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+
[root@controller ~]# cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| d6b816e1-1dcc-4f37-9bad-9d3581834233 | available | test | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

配置Dashboard门户服务

安装dashboard组件

1
yum install memcached python-memcached mod_wsgi openstack-dashboard -y

修改dashboard配置

vi /etc/openstack-dashboard/local_settings

修改CACHES部分

1
2
3
4
5
6
CACHES = {
'default': {
'BACKEND':'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION' : '127.0.0.1:11211'
}
}

修改可允许访问的主机名称
1
ALLOWED_HOSTS = ['localhost', 'controller', '10.0.0.11']

修改openstack主机名
1
OPENSTACK_HOST = "controller"

启动apache服务,分布式缓存服务
1
2
3
4
5
setsebool -P httpd_can_network_connect on
service httpd start
service memcached start
chkconfig httpd on
chkconfig memcached on

Dashboard用户web访问

浏览器访问 http://10.0.0.11/dashboard (建议使用chrome 或者 firefox)
login: admin
password: ADMIN_PASS