# ceph osd pool create volumes 128 # ceph osd pool create images 128 # ceph osd pool create backups 128 # ceph osd pool create vms 128
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‘
ceph auth get-or-create client.cinder-backup mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=backups‘
每创建一个用户会输出一个对应用户的秘钥环,秘钥环是其他节点访问集群的钥匙,如图:
用户创建完我们可以在ceph集群的mon节点上ceph auth list看下创建的用户是否正确,出现下面图那种,会导致接下来的调用ceph出现权限不正确的报错
报错信息:
例子--{your-glance-api-server}节点:
把 client.cinder 、 client.glance 和 client.cinder-backup 的密钥环复制到适当的节点,并更改所有权:
ceph auth get-or-create client.glance | ssh {your-glance-api-server} sudo tee /etc/ceph/ceph.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
也可以登录到{your-glance-api-server}节点,更改秘钥的所有权
注意:必须已经在controller节点上安装过ceph包,也就是要有/etc/ceph这个文件夹,完成后可以在controller下面看到ceph.client.glance.keyring秘钥环
例子--{your-volume-server}:
ceph auth get-or-create client.cinder | ssh {your-volume-server} sudo tee /etc/ceph/ceph.client.cinder.keyring
ceph auth get-or-create client.cinder | ssh computer-1 sudo tee /etc/ceph/ceph.client.cinder.keyring
也可以登录到{your-volume-server}节点,更改秘钥的所有权
注意:必须已经在computer-1节点上安装过ceph包,也就是要有/etc/ceph这个文件夹,完成后可以在computer-1下面看到ceph.client.cinder.keyring秘钥环
运行着 glance-api 、 cinder-volume 、 nova-compute 或 cinder-backup 的主机被当作 Ceph 客户端,它们都需要 ceph.conf 文件,copy user.keyring to glance-api node and cinder-volume node
ceph-deploy# ceph auth get-or-create client.ceph >> ceph.client.ceph.keyring
# scp ceph.client.ceph.keyring ceph.conf controller:/etc/ceph/
# scp ceph.client.ceph.keyring ceph.conf cinder-volume:/etc/ceph/
# yum install ceph-common python-rbd
# chown glance:glance /etc/ceph/ceph.client.ceph.keyring
注意:网上有的把这个给注释掉了,亲测liberty 注释不注释都是不会在给/var/lib/glance/image下存储镜像了,镜像存在了ceph集群glance pool里了
yum install ceph-common python-rbd
登录到cinder节点,对秘钥进行授权
chown cinder:cinder /etc/ceph/ceph.client.ceph.keyring

systemctl restart openstack-nova-compute.service
至此修改过的文件,对应的服务重启一下
cinder service-list 查看ceph是都up了
原文:https://www.cnblogs.com/jimmyyang/p/10791418.html