- 论坛徽章:
- 7
|
本帖最后由 milujite 于 2013-12-18 14:26 编辑
第十二章:配置存储节点
创建逻辑卷- [root@storage ~]# pvcreate /dev/sdb
- Physical volume "/dev/sdb" successfully created
- [root@storage ~]# vgcreate cinder-volumes /dev/sdb
- Volume group "cinder-volumes" successfully created
复制代码 修改lvm.conf在devices配置段修改filter:- [root@storage ~]# vi /etc/lvm/lvm.conf
- filter = [ "r/sda/", "a/sdb/", "r/.*/" ]
复制代码 安装软件包- [root@storage ~]# yum install openstack-cinder openstack-utils openstack-selinux
复制代码 配置cinder验证- [root@storage ~]# /etc/cinder/api-paste.ini
- [filter:authtoken]
- paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
- auth_host = openstack
- auth_port = 35357
- auth_protocol = http
- admin_tenant_name = service
- admin_user = cinder
- admin_password = openstack
复制代码 配置cinder连接qpid message- [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid
- [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT qpid_hostname openstack
复制代码 配置cinder连接数据库- [root@storage ~]# openstack-config --set /etc/cinder/cinder.conf database connection \ mysql://cinder:openstack@openstack/cinder
复制代码 配置iscsi-target
在targets.conf文件头部加入如下配置:- [root@storage ~]# vi /etc/tgt/targets.conf
- include /etc/cinder/volumes/*
复制代码 启动服务- [root@storage ~]# /etc/init.d/openstack-cinder-volume start
- Starting openstack-cinder-volume: [ OK ]
- [root@storage ~]# /etc/init.d/tgtd start
- Starting SCSI target daemon: [ OK ]
- [root@storage ~]# chkconfig --level 35 openstack-cinder-volume on
- [root@storage ~]# chkconfig --level 35 tgtd on
复制代码 测试cinder服务- 创建卷
- [root@openstack ~]# cinder create --display-name cinder_test 1
- +---------------------+--------------------------------------+
- | Property | Value |
- +---------------------+--------------------------------------+
- | attachments | [] |
- | availability_zone | nova |
- | bootable | false |
- | created_at | 2013-12-18T05:26:27.119613 |
- | display_description | None |
- | display_name | cinder_test |
- | id | 33c6a77c-6754-4858-a703-30cb067cabdf |
- | metadata | {} |
- | size | 1 |
- | snapshot_id | None |
- | source_volid | None |
- | status | creating |
- | volume_type | None |
- +---------------------+--------------------------------------+
-
- 在storage上查看是否生成卷:
- [root@storage ~]# lvdisplay
- --- Logical volume ---
- LV Path /dev/cinder-volumes/volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
- LV Name volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
- VG Name cinder-volumes
- LV UUID xe0ZZo-zavj-PiT4-5Z75-kLOk-tFTc-6xxuMu
- LV Write Access read/write
- LV Creation host, time storage, 2013-12-18 13:36:44 +0800
- LV Status available
- # open 1
- LV Size 1.00 GiB
- Current LE 256
- Segments 1
- Allocation inherit
- Read ahead sectors auto
- - currently set to 256
- Block device 253:0
-
- 在dashboard上将该卷映射给实例,在node01 Hypervisor上使用fdisk -l查看是否有新设备:
- [root@node01 ~]# fdisk -l
-
- Disk /dev/sda: 17.2 GB, 17179869184 bytes
- 255 heads, 63 sectors/track, 2088 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00018b8e
-
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 26 204800 83 Linux
- Partition 1 does not end on cylinder boundary.
- /dev/sda2 26 1938 15360000 83 Linux
- /dev/sda3 1938 2089 1211392 82 Linux swap / Solaris
-
- Disk /dev/sdb: 1073 MB, 1073741824 bytes
- 34 heads, 61 sectors/track, 1011 cylinders
- Units = cylinders of 2074 * 512 = 1061888 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000000
- [root@node01 ~]# iscsiadm -m node
- 192.168.1.102:3260,-1 iqn.2010-10.org.openstack:volume-c9aa6f08-e525-4d2f-9c24-a2089b21a5dc
-
- 在cirros实例上验证,通过fdisk命令,查看,已经生成/dev/vdb块设备。
-
- 在openstack上查看映射状态
- [root@openstack ~]# cinder list
- +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
- | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
- +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
- | c9aa6f08-e525-4d2f-9c24-a2089b21a5dc | in-use | cinder_test | 1 | None | false | 2deb480f-2e6b-41ed-b6f0-4fbd4b1afdf5 |
- +--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
复制代码 |
|