openstack安装笔记 Cinder(三)

问题,怎么在一个操作后,看系统中多了和修改了哪些内容

yum源配置参考前两篇
yum install openstack-cinder openstack-utils python-kombu python-amqplib


source  /root/keystone_admin
内容为
cat  /root/keystone_admin
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://172.16.21.233:35357/v2.0/
export PS1='[\u@\h \W(keystone_admin)]\$ '


在keystone中加service
 keystone service-create --name cinder  --type volume --description "Cinder Volume Service hao"
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |    Cinder Volume Service hao     |
|      id     | 97dd83f58ab949ba88d543b26665b564 |
|     name    |              cinder              |
|     type    |              volume              |
+-------------+----------------------------------+

在keystone库中加了一条数据

keystone endpoint-create --service-id  cinder --publicurl "http://172.16.21.233:8776/v1/\$(tenant_id)s" --adminurl "http://172.16.21.233:8776/v1/\$(tenant_id)s" --internalurl "http://172.16.21.233:8776/v1/\$(tenant_id)s" --region beijing
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+-------------+--------------------------------------------+
|   Property  |                   Value                    |
+-------------+--------------------------------------------+
|   adminurl  | http://172.16.21.233:8776/v1/$(tenant_id)s |
|      id     |      7f99d9b455354bd2b44b16c2d13654ba      |
| internalurl | http://172.16.21.233:8776/v1/$(tenant_id)s |
|  publicurl  | http://172.16.21.233:8776/v1/$(tenant_id)s |
|    region   |                  beijing                   |
|  service_id |      97dd83f58ab949ba88d543b26665b564      |
+-------------+--------------------------------------------+
[root@controller ~(keystone_admin)]# 


keystone库的endpoint表加了三条数据

vmware iscs硬盘新建个10G的
然后
pvcreate  /dev/sdb  
vgcreate vgstorage /dev/sdb
vgs
lvs

修改Cinder的配置文件,在配置文件里面指定了keystone的设置,cinder采用的逻辑卷的名称vgstorage,和指定了cinder服务器的ip地址
cp /etc/cinder/cinder.conf cinder.conf
修改后vimdiff观察修改,每个操作启示就是在default下面多了一行
openstack-config --set /etc/cinder/cinder.conf  DEFAULT auth_strategy keystone
openstack-config --set /etc/cinder/cinder.conf DEFAULT sql_connection   mysql://cinder:[email protected]/cinder
openstack-config --set /etc/cinder/cinder.conf DEFAULT volume_group vgstorage
openstack-config --set /etc/cinder/cinder.conf DEFAULT volume_driver cinder.volume.drivers.lvm.LVMISCSIDriver
openstack-config --set /etc/cinder/cinder.conf DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu
openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 172.16.21.233
openstack-config --set /etc/cinder/cinder.conf DEFAULT rabbit_host  172.16.21.233
openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken auth_host 172.16.21.233
openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken admin_tenant_name admin
openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken admin_user admin 
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password openstack

cinde.conf多了如下
 [DEFAULT]                                                
  auth_strategy = keystone                                 
  sql_connection = mysql://cinder:[email protected]/cinder
  volume_group = vgstorage  
  volume_driver = cinder.volume.drivers.lvm.LVMISCSIDriver
  rpc_backend = cinder.openstack.common.rpc.impl_kombu    
  my_ip = 172.16.21.233                                    
  rabbit_host = 172.16.21.233 

[keystone_authtoken]                                     
  auth_host = 172.16.21.233                             
  admin_tenant_name = admin                          
  admin_user = admin                                     
  admin_password = openstack 


创建cinder数据库
openstack-db --init --service cinder --password cinder --rootpw openstack

migrate_version表默认有一条数据
quota_classes表会有默认三条数据
volumes snapshots gigabytes

修改权限
chown -R cinder:cinder /etc/cinder
chown -R cinder:cinder /var/lib/cinder
chown -R cinder:cinder /var/log/cinder


配置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 |
+----+--------+--------------+------+-------------+----------+-------------+
+----+--------+--------------+------+-------------+----------+-------------+
[root@controller volumes(keystone_admin)]# lvdisplay
[root@controller volumes(keystone_admin)]# vgs
  VG        #PV #LV #SN Attr   VSize  VFree 
  vgstorage   1   0   0 wz--n- 10.00g 10.00g
[root@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                 |
+---------------------+--------------------------------------+
[root@controller volumes(keystone_admin)]# 
[root@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 
???? 怎么绑定?

猜你喜欢

转载自haoningabc.iteye.com/blog/2183257
今日推荐