配置iSCSI服务,配合Cinder,将Cinder创建的逻辑卷通过iscsi挂载给虚拟机
vi /etc/tgt/targets.conf,添加一行:
include /etc/cinder/volumes/*
·设置tgtd服务开机自启动,并启动tgtd服务
chkconfig tgtd on
service tgtd start
·设置Cinder服务开机自启动,并启动Cinder服务
chkconfig openstack-cinder-api on
chkconfig openstack-cinder-scheduler on
chkconfig openstack-cinder-volume on
service openstack-cinder-api start
service openstack-cinder-scheduler start
service openstack-cinder-volume start
cinder list 查看目前的EBS块存储
# cinder list
+----+--------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+----+--------+--------------+------+-------------+----------+-------------+
+----+--------+--------------+------+-------------+----------+-------------+
[iyunv@controller volumes(keystone_admin)]# lvdisplay
[iyunv@controller volumes(keystone_admin)]# vgs
VG #PV #LV #SN Attr VSize VFree
vgstorage 1 0 0 wz--n- 10.00g 10.00g
[iyunv@controller volumes(keystone_admin)]# cinder create --display-name=vol-1G 1
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2015-02-04T06:41:05.986450 |
| display_description | None |
| display_name | vol-1G |
| encrypted | False |
| id | d6e1529f-633c-4e86-ad45-fc61734b950e |
| metadata | {} |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | None |
+---------------------+--------------------------------------+
[iyunv@controller volumes(keystone_admin)]#
[iyunv@controller volumes(keystone_admin)]# lvdisplay
--- Logical volume ---
LV Path /dev/vgstorage/volume-d6e1529f-633c-4e86-ad45-fc61734b950e
LV Name volume-d6e1529f-633c-4e86-ad45-fc61734b950e
VG Name vgstorage
LV UUID ff6Rkw-GCFP-UEMx-SydY-rcJa-fpEJ-4xnH1L
LV Write Access read/write
LV Creation host, time controller, 2015-02-03 22:41:06 -0800
LV Status available
# open 0
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
当将该卷绑定到VM上面后可以查看:
tgtadm --lld iscsi --op show --mode target
???? 怎么绑定?