CINDER_PASSWD=‘cinder1234!‘
controllerHost=‘controller‘
RABBIT_PASSWD=‘0penstackRMQ‘
为cinder-volume服务创建pool池(因为我只有一个OSD节点,所以要将副本数设置为1)
ceph osd pool create cinder-volumes 32
ceph osd pool set cinder-volumes size 1
ceph osd pool application enable cinder-volumes rbd
ceph osd lspools
ceph df
ceph auth get-or-create client.cinder-volumes mon ‘allow r‘ osd ‘allow class-read object_prefix rbd_children, allow rwx pool=cinder-volumes, allow rwx pool=glance-images‘ -o /etc/ceph/ceph.client.cinder-volumes.keyring
#查看
ceph auth ls | grep -EA3 ‘client.(cinder-volumes)‘
su - cephd
cd ~/ceph-cluster/
cat <<EOF>> ceph.conf
[client.cinder-volumes]
keyring = /etc/ceph/ceph.client.cinder-volumes.keyring
EOF
ceph-deploy --overwrite-conf admin ceph-mon01
exit
yum -y install openstack-cinder python-keystone ceph-common
uuidgen
运行uuidgen命令可以得到下面的UUID值:
086037e4-ad59-4c61-82c9-86edc31b0bc0
openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/cinder/cinder.conf cache backend oslo_cache.memcache_pool
openstack-config --set /etc/cinder/cinder.conf cache enabled true
openstack-config --set /etc/cinder/cinder.conf cache memcache_servers ${controllerHost}:11211
openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://${controllerHost}:5000
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://${controllerHost}:5000
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_id default
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_id default
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder
openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password ${CINDER_PASSWD}
openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp
openstack-config --set /etc/cinder/cinder.conf DEFAULT enabled_backends ceph
openstack-config --set /etc/cinder/cinder.conf ceph volume_driver cinder.volume.drivers.rbd.RBDDriver
openstack-config --set /etc/cinder/cinder.conf ceph rbd_pool cinder-volumes
openstack-config --set /etc/cinder/cinder.conf ceph rbd_user cinder-volumes
openstack-config --set /etc/cinder/cinder.conf ceph rbd_ceph_conf /etc/ceph/ceph.conf
openstack-config --set /etc/cinder/cinder.conf ceph rbd_flatten_volume_from_snapshot false
openstack-config --set /etc/cinder/cinder.conf ceph bd_max_clone_depth 5
openstack-config --set /etc/cinder/cinder.conf ceph rbd_store_chunk_size 4
openstack-config --set /etc/cinder/cinder.conf ceph rados_connect_timeout -1
openstack-config --set /etc/cinder/cinder.conf ceph glance_api_version 2
openstack-config --set /etc/cinder/cinder.conf ceph rbd_secret_uuid 086037e4-ad59-4c61-82c9-86edc31b0bc0
systemctl enable openstack-cinder-volume.service
systemctl start openstack-cinder-volume.service
systemctl status openstack-cinder-volume.service
cat << EOF > ~/secret.xml
<secret ephemeral=‘no‘ private=‘no‘>
<uuid>086037e4-ad59-4c61-82c9-86edc31b0bc0</uuid>
<usage type=‘ceph‘>
<name>client.cinder-volumes secret</name>
</usage>
</secret>
EOF
ceph auth get-key client.cinder-volumes
得到如下的结果:
AQCxfDFdgp2qKRAAUY/vep29N39Qv7xWKYqMUw==
virsh secret-define --file ~/secret.xml
virsh secret-set-value --secret 086037e4-ad59-4c61-82c9-86edc31b0bc0 --base64 AQCxfDFdgp2qKRAAUY/vep29N39Qv7xWKYqMUw==
virsh secret-list
systemctl restart libvirtd.service
systemctl status libvirtd.service
先在所有的监视器节点上开启删除pool的权限,然后才可以删除。
删除pool时ceph要求必须输入两次pool名称,同时加上--yes-i-really-really-mean-it选项。
echo ‘
mon_allow_pool_delete = true
[mon]
mon allow pool delete = true
‘ >> /etc/ceph/ceph.conf
systemctl restart ceph-mon.target
ceph osd pool delete cinder-volumes cinder-volumes --yes-i-really-really-mean-it
ceph auth del client.cinder-volumes
查看:
virsh secret-list
删除(secret-undefine后跟uuid值):
virsh secret-undefine 086037e4-ad59-4c61-82c9-86edc31b0bc0
原文:https://www.cnblogs.com/jipinglong/p/11215107.html