Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zhanghui9700/9780524 to your computer and use it in GitHub Desktop.
Save zhanghui9700/9780524 to your computer and use it in GitHub Desktop.
ceph config for openstack glance and cinder
ceph-deploy disk list ceph-client
ceph-deploy disk zap ceph-client:/dev/sdb
ceph-deploy disk prepare ceph-client:/dev/sdb
ceph-deploy disk activate ceph-client:/dev/sdb
---
ceph osd lspools
ceph auth list
ceph auth get-key client.images
---
rbd -p data
rbd -p data ls -l
rbd -p data create foo --size 1024
rbd rm data/foo
rbd --id volumes ls volumes #rbd --id username ls poolname
---
qemu-img create -f rbd rbd:data/foo 1G
qemu-img info -f rbd rbd:data/foo
#for openstack
---
ceph osd pool create volumes 3
ceph osd pool create images 3
ceph auth get-or-create client.volumes mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rx pool=images'
ceph auth get-or-create client.images mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'
ceph auth get-key client.volumes | ssh compute-host tee client.volumes.key
cat > secret.xml <<EOF
<secret ephemeral='no' private='no'>
<usage type='ceph'>
<name>client.volumes secret</name>
</usage>
</secret>
EOF
virsh secret-define --file secret.xml
virsh secret-set-value --secret {uuid of secret} --base64 $(cat client.volumes.key) && rm client.volumes.key secret.xml
###/etc/glance/glance-api.conf
default_store=rbd
rbd_store_user=images
rbd_store_pool=images
###/etc/cinder/cinder.conf
volume_driver=cinder.volume.drivers.rbd.RBDDriver
rbd_pool=volumes
glance_api_version=2
rpd_user=volumes
rbd_secret_uuid=afc4d4a6-37a7-c208-eb74-35c91d8684b7
# service openstack-glance-api restart
# service openstack-glance-registry restart
# service openstack-glance-scrubber restart
#service nova-compute restart
#service cinder-volume restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment