cinder 就是 云硬盘
配置cinder步骤
1 安装软件包,然后到keystone注册
创建必要的用户名 密码
服务
endpoint
2 设置配置文件
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
28
|
yum
install
openstack-cinder -y
keystone user-create --name cinder --pass hequan
keystone user-role-add --user cinder --role admin --tennat services
keystone service-create --name cinder --
type
volume --description cinderxxx
例子 关于cul
keystone service-list
| d1271040fa9144318a836a0b476d1e66 | cinder | volume | Cinder Service |
keystone endpoint-list |
grep
d1271040fa9144318a836a0b476d1e66
| 8e18c46fc51c4a6287ea740a37537a59 | RegionOne | http:
//115
.29.107.17:8776
/v1/
%(tenant_id)s | http:
//115
.29.107.17:8776
/v1/
%(tenant_id)s | http:
//115
.29.107.17:8776
/v1/
%(tenant_id)s | d1271040fa9144318a836a0b476d1e66 |
keystone endpoint-create --service-
id
d1271040fa9144318a836a0b476d1e66 --publicul
'http://115.29.107.17:8776/v1/%(tenant_id)s'
--internalurl
'http://115.29.107.17:8776/v1/%(tenant_id)s'
--adminurl
'http://115.29.107.17:8776/v1/%(tenant_id)s'
[root@hequan ~(keystone_admin)]
# cd /etc/cinder/
[root@hequan cinder(keystone_admin)]
# ls
api-
paste
.ini policy.json rootwrap.d
cinder.conf rootwrap.conf volumes
[root@hequan cinder(keystone_admin)]
# cp cinder.conf cinder.conf.bak ##备份
[root@hequan ~(keystone_admin)]
# cp /usr/share/cinder/cinder-dist.conf /etc/cinder/cinder.conf ##复制配置文件
[root@hequan cinder(keystone_admin)]
# chown root.cinder cinder.conf ##记得修改权限
[root@hequan cinder(keystone_admin)]
# openstack-db --init -service cinder --password hequan --rootpw 123456 ##创建数据库
|
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
[root@hequan cinder(keystone_admin)]
# vim cinder.conf
[DEFAULT]
logdir =
/var/log/cinder
state_path =
/var/lib/cinder
lock_path =
/var/lib/cinder/tmp
volumes_dir =
/etc/cinder/volumes
iscsi_helper = lioadm
rootwrap_config =
/etc/cinder/rootwrap
.conf
auth_strategy = keystone
[database]
connection = mysql:
//cinder
:hequan@115.29.107.17
/cinder
[keystone_authtoken]
admin_tenant_name = services
admin_user = cinder
admin_password = hequan
auth_host = 115.29.107.17
auth_port = 35357
auth_protocol = http
[root@hequan cinder(keystone_admin)]
# grep ^rabbit /etc/keystone/keystone.conf
rabbit_host = localhost
rabbit_port = 5672
rabbit_hosts = localhost:5672
rabbit_use_ssl = False
rabbit_userid = guest
rabbit_password = guest
rabbit_virtual_host = /
rabbit_ha_queues = False
##把这些写到上面的配置文件里,通信用
[root@hequan cinder(keystone_admin)]
# systemctl list-unit-files | grep cinder
openstack-cinder-api.service enabled
##用户接口
openstack-cinder-backup.service enabled
##备份
openstack-cinder-scheduler.service enabled
##调度
openstack-cinder-volume.service enabled
##后端存储 卷
[root@hequan cinder(keystone_admin)]
# systemctl is-active openstack-cinder-api.service
active
[root@hequan cinder(keystone_admin)]
# systemctl start openstack-cinder-api.service openstack-cinder-backup.service openstack-cinder-scheduler.service openstack-cinder-volume.service
[root@hequan cinder(keystone_admin)]
# systemctl enable openstack-cinder-api.service openstack-cinder-backup.service openstack-cinder-scheduler.service openstack-cinder-volume.service
再创建一个cinderv2 和上面一样
| 8fe36f49892447679bc5433b21591906 | cinderv2 | volumev2 | Cinder Service v2 |
| 75a8f5bbf35a42a0bfcd2e6a0d4cea9c | RegionOne | http:
//115
.29.107.17:8776
/v2/
%(tenant_id)s | http:
//115
.29.107.17:8776
/v2/
%(tenant_id)s | http:
//115
.29.107.17:8776
/v2/
%(tenant_id)s | 8fe36f49892447679bc5433b21591906 |
|
2 修改配置
1
2
3
4
5
|
[root@hequan cinder(keystone_admin)]
# cinder list
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
|
1
2
3
4
5
6
|
创建VG
[root@hequan cinder(keystone_admin)]
# pvcreate /dev/xvdb
[root@hequan cinder(keystone_admin)]
# vgcreate cinder-volumes /dev/xvdb
[root@hequan cinder(keystone_admin)]
# vgs
VG
#PV #LV #SN Attr VSize VFree
cinder-volumes 1 0 0 wz--n- 20.60g 20.60g
|
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
28
29
30
31
32
33
34
35
36
|
[root@hequan cinder(keystone_admin)]
# cinder create --display-name voll 1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable |
false
|
| consistencygroup_id | None |
| created_at | 2016-07-27T15:14:07.000000 |
| description | None |
| encrypted | False |
|
id
| 7f778803-41cd-492f-b3b7-baa349b9c3dc |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | voll |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | ddac36f63e4547e0a8619574dbc41534 |
| os-volume-replication:driver_data | None |
| os-volume-replication:extended_status | None |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| user_id | 9382216e2ea540a2af70216577dbed00 |
| volume_type | None |
+---------------------------------------+--------------------------------------+
[root@hequan cinder(keystone_admin)]
# cinder list
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
| 7f778803-41cd-492f-b3b7-baa349b9c3dc | available | - | voll | 1 | - |
false
| False | |
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
##添加到上面的配置 cinder.conf中 作为单独字段
[lvm]
iscsi_helper=lioadm
volume_group=cinder-volumes
##那个组决定默认存储
iscsi_ip_address=115.29.107.17
volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver
##云硬盘默认存储LVM
volumes_dir=
/var/lib/cinder/volumes
iscsi_protocol=iscsi
volume_backend_name=lvm
[root@hequan cinder(keystone_admin)]
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
volume-7f778803-41cd-492f-b3b7-baa349b9c3dc cinder-volumes -wi-a----- 1.00g
[root@hequan cinder(keystone_admin)]
# lvscan
ACTIVE
'/dev/cinder-volumes/volume-7f778803-41cd-492f-b3b7-baa349b9c3dc'
[1.00 GiB] inherit
|
1
2
3
4
5
6
|
更换名字
volume_group=vg0
[root@hequan cinder(keystone_admin)]
# vgrename cinder-volumes vg0 ##更改名字
[root@hequan ~]
# vgs
VG
#PV #LV #SN Attr VSize VFree
vg0 1 2 0 wz--n- 20.60g 9.60g
|
1
2
3
4
5
6
7
8
9
10
11
|
待测试 ceph做后端存储 具体ceph配置 可看我前一篇glance
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = cinder
#ceph 卷名字
rbd_ceph_conf =
/etc/ceph/ceph
.conf
rbd_flatten_volume_from_snapshot =
false
rbd_max_clone_depth = 5
rbd_stone_chunk_size = 4
rados_connect_timeout = -1
glance_api_version = 2
setfacl -m u:cinder:r--
/etc/ceph/ceph
.client.admin.keyring
##cinder可读
|
本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1830981,如需转载请自行联系原作者