本次 Openstack 版本为N版ceph版本为J版在对接volume和glance时非常轻松不过在对接nova的时候坑了一下午。
ERROR nova.compute.manager [instance: b6b53548-2d12-4019-a189-1d006455dfa3] 2017-08-07T14:09:55.209454Z qemu-system-x86_64: -drive file=rbd:vms/b6b53548-2d12-4019-a189-1d006455dfa3_disk:id=cinder:auth_supported=cephx\;none:mon_host=192.168.0.151\:6789,file.password-secret=virtio-disk0-secret0,format=raw,if=none,id=drive-virtio-disk0,cache=none: Unknown protocol 'rbd'
意思是说不支持rbd协议 于是乎查看自己的qemu。
[root@compute01 ~]# qemu-img --help | grep rbd
[root@compute01 ~]#
注此时我已经装了ceph相关的包现在已经有了rbd的命令内核已经也已经有了rbd现在是qemu不支持rbd协议接下来继续证明这个事情
[root@compute01 ~]# rados lspools
glance
volumes
vms
rbd
images
[root@compute01 ~]# rbd ls volumes
volume-4a898a0e-40db-4846-b944-079891598ae4
[root@compute01 ~]#
[root@compute01 ~]# qemu-img create -f raw rbd:volumes/test 5G
qemu-img: rbd:volumes/test: Unknown protocol 'rbd'
[root@compute01 ~]#
可以看到直接让qemu使用ceph都不行报不支持rbd协议此时 我回想自己编译qemu时是默认选项查了好多文档默认是不支持rbd的所以要重新编译此次开启rbd
[root@compute01 qemu-2.9.0]# ./configure --enable-rbd
No C++ compiler available; disabling C++ specific optional code
ERROR: User requested feature rados block device
configure was not able to find it.
Install librbd/ceph devel
报No C++我们来安装包
[root@compute01 qemu-2.9.0]# yum install gcc gcc-c++
Installed:
gcc-c++.x86_64 0:4.8.5-11.el7
Dependency Installed:
libstdc++-devel.x86_64 0:4.8.5-11.el7
Complete!
再次编译
[root@compute01 qemu-2.9.0]# ./configure --enable-rbd
ERROR: User requested feature rados block device
configure was not able to find it.
Install librbd/ceph devel
报找不到ceph 的librdb我们继续装包
[root@compute01 qemu-2.9.0]# yum install ceph-devel
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ceph-devel-compat.x86_64 1:10.2.9-0.el7 will be installed
Installed:
ceph-devel-compat.x86_64 1:10.2.9-0.el7
Dependency Installed:
libcephfs1-devel.x86_64 1:10.2.9-0.el7 libcephfs_jni1.x86_64 1:10.2.9-0.el7
libcephfs_jni1-devel.x86_64 1:10.2.9-0.el7 librados2-devel.x86_64 1:10.2.9-0.el7
libradosstriper1-devel.x86_64 1:10.2.9-0.el7 librbd1-devel.x86_64 1:10.2.9-0.el7
Complete!
再次编译
[root@compute01 qemu-2.9.0]# ./configure --enable-rbd
Install prefix /usr/local
BIOS directory /usr/local/share/qemu
binary directory /usr/local/bin
library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M
rbd support yes ###重点来了
NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization yes
replication support yes
[root@compute01 qemu-2.9.0]# make && make install