OpenStack+Ceph平台集成

文档下载

OpenStack+Ceph平台构建(已排好版)node

参考文档

官方文档python

OpenStack集成Ceph后端

如何将Ceph与OpenStack集成api

部署步骤

Ceph配置

建立Poolssh

# ceph osd pool create volumes 64ide

# ceph osd pool create images 64ui

# ceph osd pool create vms 64url

OpenStack配置

安装Ceph Client包

在glance-api(控制节点)节点上spa

yum install python-rbd -y.net

在nova-compute(计算节点)和cinder-volume节点上

yum install ceph-common -y

复制配置文件到OpenStack相关节点

 

ssh controller sudo tee /etc/ceph/ceph.conf < /etc/ceph/ceph.conf

ssh compute sudo tee /etc/ceph/ceph.conf < /etc/ceph/ceph.conf

为Nova/Cinder and Glance建立新的用户

只有开启了cephx authentication,才须要

一、建立密钥,用的是auth get-or-create

ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images'

 

ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'

二、为client.cinder, client.glance添加keyring,并修改所属主/组

ceph auth get-or-create client.glance | ssh controller sudo tee /etc/ceph/ceph.client.glance.keyring

 

ssh controller sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring

ceph auth get-or-create client.cinder | ssh compute sudo tee /etc/ceph/ceph.client.cinder.keyring

 

ssh compute sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring

三、为nova-compute节点上建立临时密钥

ceph auth get-key client.cinder | ssh {your-compute-node} tee client.cinder.key

此处为:

ceph auth get-key client.cinder | ssh compute tee client.cinder.key

四、在全部计算节点上(本例就只有一台计算节点)执行以下操做:在计算节点上为libvert替换新的key。

由于libvirt建立磁盘时,须要访问ceph集群。因此须要替换key

uuidgen

536f43c1-d367-45e0-ae64-72d987417c91

 

cat > secret.xml <<EOF

#粘贴如下内容,注意将红色key替换为新生成的key

<secret ephemeral='no' private='no'>

<uuid>536f43c1-d367-45e0-ae64-72d987417c91</uuid>

<usage type='ceph'>

<name>client.cinder secret</name>

</usage>

</secret>

EOF

 

virsh secret-define --file secret.xml

 

以--base64 后的秘钥为计算节点上/root目录下的client.cinder.key。是以前为计算节点建立的临时秘钥文件

virsh secret-set-value  536f43c1-d367-45e0-ae64-72d987417c91  AQCliYVYCAzsEhAAMSeU34p3XBLVcvc4r46SyA==

这是经过--base64() 做用临时密钥生成的

AQCliYVYCAzsEhAAMSeU34p3XBLVcvc4r46SyA==

这里也能够替换为

--base64 $(cat client.cinder.key)

而后删除临时密钥

rm –f client.cinder.key secret.xml

五、修改配置文件
glance-api.conf

[DEFAULT]

 

 

default_store = rbd

show_image_direct_url = True

show_multiple_locations = True

 

 

[glance_store]

stores = rbd

default_store = rbd

rbd_store_pool = images

rbd_store_user = glance

rbd_store_ceph_conf = /etc/ceph/ceph.conf

rbd_store_chunk_size = 8

取消Glance cache管理,去掉cachemanagement

[paste_deploy]

flavor = keystone

cinder-voluem的cinder.conf

[DEFAULT]

 

保留以前的

enabled_backends = ceph

#glance_api_version = 2

 

[ceph]

 

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

rbd_store_chunk_size = 4

rados_connect_timeout = -1

glance_api_version = 2

rbd_user = cinder

volume_backend_name = ceph

rbd_secret_uuid =536f43c1-d367-45e0-ae64-72d987417c91

注意, 全部计算节点上的 UUID 不必定非要同样。但考虑到平台的一致性, 最好使用同一个 UUID

注意,若是配置多个cinder后端,glance_api_version = 2必须添加到[DEFAULT]中。本例注释了

 

compute节点nova.conf

 

[libvirt]

virt_type = qemu

hw_disk_discard = unmap

images_type = rbd

images_rbd_pool = vms

images_rbd_ceph_conf = /etc/ceph/ceph.conf

rbd_user = cinder

rbd_secret_uuid = 536f43c1-d367-45e0-ae64-72d987417c91

disk_cachemodes="network=writeback"

libvirt_inject_password = false

libvirt_inject_key = false

libvirt_inject_partition = -2

live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_LIVE, VIR_MIGRATE_TUNNELLED

六、重启OpenStack

systemctl restart openstack-glance-api.service

 

systemctl restart openstack-nova-compute.service openstack-cinder-volume.service

验证

glance验证

一、下载Cirros镜像并将其添加到Glance。

wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

二、将QCOW2转换为RAW。 使用Ceph,image必须是 RAW格式。

qemu-img convert cirros-0.3.4-x86_64-disk.img cirros-0.3.4-x86_64-disk.raw

三、将镜像添加到Glance

glance image-create --name "Cirros 0.3.4" --disk-format raw --container-format bare --visibility public --file cirros-0.3.4-x86_64-disk.raw

 

cinder验证

一、建立Cinder卷

cinder create --display-name="test" 1

二、在Ceph中列出Cinder卷。

$ sudo rbd ls volumes

volume-d251bb74-5c5c-4c40-a15b-2a4a17bbed8b

 

$ sudo rbd info volumes/volume-d251bb74-5c5c-4c40-a15b-2a4a17bbed8b

nova验证

一、启动使用在Glance步骤中添加的Cirros镜像的临时VM实例

nova boot --flavor m1.small --nic net-id=4683d03d-30fc-4dd1-9b5f-eccd87340e70 --image='Cirros 0.3.4' cephvm

二、等待VM处于活动状态

nova list

三、在Ceph虚拟机池中列出镜像。咱们如今应该看到镜像存储在Ceph中

sudo rbd -p vms ls

相关文章
相关标签/搜索