https://ervikrant06.wordpress.com/2015/10/24/how-to-configure-ceph-as-nova-compute-backend/
在Ceph的admin-node上进行如下操作:
1. ceph osd pool create vms 128
2. ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=vms, allow rx pool=images'
在OpenStack的node上进行如下操作:
1. 将admin-node上的ceph.conf拷贝到controller的/etc/ceph目录下 (在结合glance时已经执行了这一步)
2. 在admin-node上运行ceph auth get-key client.nova, 然后在compute上保存为/etc/ceph/ceph.client.nova.keyring, 同时将返回的结果追加到compute的ceph.conf中
3. chown nova:nova /etc/ceph/ceph.client.nova.keyring
4. 通过uuidgen得到一个随机的uuid, 然后在compute上创建/etc/ceph/secret.xml, 将下列内容添加到这个文件:
<secret ephemeral='no' private='no'>
<uuid>df1dabbf-c8b6-46a6-b427-1fad700370f0</uuid>
<usage type='ceph'>
<name>client.nova secret</name>
</usage>
</secret>
5. virsh secret-define --file /etc/ceph/secret.xml
6. virsh secret-set-value --secret df1dabbf-c8b6-46a6-b427-1fad700370f0 --base64 <这里填入/etc/ceph/ceph.client.nova.keyring中的base64值>
7. 在compute的/etc/nova/nova.conf中加入以下行:
[libvirt]
images_type = rbd
images_rbd_pool = vms
images_rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_user = nova
rbd_secret_uuid = df1dabbf-c8b6-46a6-b427-1fad700370f0
disk_cachemodes="network=writeback"
8. nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64 demo-instance1
9. nova list
备注:
1. rbd -p vms ls
350d6217-e7b8-46e8-be71-a6a22b0603ae_disk
2. 在compute上运行ll -h /var/lib/nova/instances, 你会发现硬盘不在此文件夹下:
total 24K
drwxr-xr-x 5 nova nova 4.0K Nov 5 15:44 ./
drwxr-xr-x 9 nova nova 4.0K Oct 28 13:27 ../
drwxr-xr-x 2 nova nova 4.0K Nov 5 15:44 _base/
drwxr-xr-x 2 nova nova 4.0K Nov 5 15:44 c88ac315-f203-4abb-86d8-666f53f0d03b/
-rw-r--r-- 1 nova nova 31 Nov 5 14:11 compute_nodes
drwxr-xr-x 2 nova nova 4.0K Nov 5 15:44 locks/
ll -h /var/lib/nova/instances/c88ac315-f203-4abb-86d8-666f53f0d03b
total 36
drwxr-xr-x 2 nova nova 4.0K Nov 5 15:44 ./
drwxr-xr-x 5 nova nova 4.0K Nov 5 15:44 ../
-rw-rw---- 1 libvirt-qemu kvm 24K Nov 5 15:45 console.log
-rw-r--r-- 1 nova nova 2.4K Nov 5 15:44 libvirt.xml
3. rbd -p vms info 350d6217-e7b8-46e8-be71-a6a22b0603ae_disk
rbd image '350d6217-e7b8-46e8-be71-a6a22b0603ae_disk':
size 1024 MB in 256 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.5e682ae8944a
format: 2
features: layering
flags:
4. ceph.client.nova.keyring的错误会导致nova-compute这个服务无法启动