1. Ceph与OpenStack整合(仅为云主机提供云盘功能)
创建: linhaifeng,最新修改: 大约1分钟以前
ceph
ceph osd pool create volumes 128 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' -o /etc/ceph/ceph.client.cinder.keyring
部署一个cinder-volume节点。部署过程中可能报错(部署过程请参考官方文档)
报错内容:
2016-05-25 08:49:54.917 24148 TRACE cinder RuntimeError: Could not bind to 0.0.0.0:8776 after trying for 30 seconds
问题分析:
RuntimeError->访问违例,这种情况是由于0.0.0.0:8776端口冲突的问题,如果你讲cinder-api和cinder-schduler,cinder-volume部署在同一台机器
就会有这个端口冲突的问题,我遇到的情况是haproxy的端口和cinder-api的端口都是8776
解决方法:
vim /etc/cinder/cinder.conf
新增如下两行:
osapi_volume_listen=172.16.209.17
osapi_volume_listen_port=8776
在ceph的monitor节点创建pool,创建对这个pool有rwx权限的账号,导出该账号的秘钥文件拷贝给cinder-volume节点和需要使用该pool的计算节点,只发送配置文件给cinder-volume节点(计算节点要想获取ceph集群信息由cinder-volume节点告诉他,所以不需要配置文件 )
创建存储池volume-pool,请记池的名字,cinder-volume和compute节点都需要在配置文件中指定这个池
创建访问volume-pool这个池的账号,注意:下面我标红的部分 ,账号名字必须是client. 开头(client.cinder其中cinder就是你的账号名,client代表你的角色是客户端,),导出的账号秘钥文件命名规则为ceph.client.账号名.keyring (这个文件必须放到ceph客户端的/etc/ceph目录下)
将ceph集群的配置文件和上一步创建的秘钥文件一并发送给客户端(cinder-volume节点,compute节点),注意:一定要将这两个文件拷贝到ceph客户端的/etc/ceph目录下(cinder.conf中有很多缺省配置,寻找ceph配置文件的路径默认/et/ceph)
scp -r /etc/ceph/ceph.conf cinder-volume节点ip:/etc/ceph
scp -r /etc/ceph/ceph.client.cinder.keyring cinder-volume节点ip:/et/ceph
scp -r /etc/ceph/ceph.conf compute节点ip:/etc/ceph
scp -r /etc/ceph/ceph.client.cinder.keyring compute节点ip:/etc/ceph
配置cinder-volume节点
yum install ceph-common -y
修改 /etc/cinder/cinder.conf:
[DEFAULT]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
storage_availability_zone=blockstrage03-ceph
rbd_pool = volume-pool
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false
rbd_max_clone_depth = 5
rbd_store_chunk_size = 4
rados_connect_timeout = -1
glance_api_version = 2
rbd_user = cinder
/etc/init.d/openstack-cinder-volume restart
tail -f /var/log/cinder/volume.log
报错:Unable to update stats, RBDDriver -1.1.0 driver is uninitialized.
问题分析:cinder-volume无法连接ceph集群导致驱动无法正常初始化,请看2->b->i和2->c 标红部分
解决方法:参照2->b-i和2->c标红部分指示的命名规则重新命名你的文件,以及文件在客户端的存放路径,重启openstack-cinder-volume服务
配置compute节点,升级qemu-*包,重启libvirtd,制作秘钥文件导入libvirt
[root@compute04 ~]# rpm -qa |grep qemu
qemu-kvm-tools-0.12.1.2-2.415.el6.3ceph.x86_64
qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64
gpxe-roms-qemu-0.9.7-6.14.el6.noarch
qemu-img-0.12.1.2-2.415.el6.3ceph.x86_64
qemu-guest-agent-0.12.1.2-2.415.el6.3ceph.x86_64
[root@compute04 ~]# virsh version
Compiled against library: libvirt 0.10.2
Using library: libvirt 0.10.2
Using API: QEMU 0.10.2
Running hypervisor: QEMU 0.12.1
[root@compute04 ~]# /usr/libexec/qemu-kvm -drive format=?
Supported formats: raw cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 qed vhdx parallels nbd blkdebug host_cdrom host_floppy host_device file gluster gluster gluster gluster rbd
[root@compute04 ~]# /usr/libexec/qemu-kvm -M ?
Supported machines are:
pc RHEL 6.5.0 PC (alias of rhel6.5.0)
rhel6.5.0 RHEL 6.5.0 PC (default)
rhel6.4.0 RHEL 6.4.0 PC
rhel6.3.0 RHEL 6.3.0 PC
rhel6.2.0 RHEL 6.2.0 PC
rhel6.1.0 RHEL 6.1.0 PC
rhel6.0.0 RHEL 6.0.0 PC
rhel5.5.0 RHEL 5.5.0 PC
rhel5.4.4 RHEL 5.4.4 PC
rhel5.4.0 RHEL 5.4.0 PC
如果升级后新建虚拟机碰到上述提示信息,可以修改虚拟机的xml配置文件,machine=‘rhel6.5.0’或者干脆删掉machine,然后用virsh define 虚拟机名字.xml
hvm
yum install ceph-common -y
注意:目前生产环境是基于centos6.5构建openstack I版本,openstack-nova-compute-2014.1.5-1.el6.noarch->libvirt-python-0.10.2-54->libvirt 0.10.2-> QEMU 0.12.1,而这个版本的QEMU不支持rbd协议,openstack-nova-compute-2014.1.5-1只支持ibvirt-python-0.10.2-54,如果你升级
libvirt那么相应的libvirt-python也要升级,进而openstack-nova-compute也要升级,其实你只需要用同一版本的qemu带ceph支持的包替换原来的qemu版本就可以了。
查看命令(升级后的结果应该是这样)
升级方法: Supported formats: raw cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 qed vhdx parallels nbd blkdebug host_cdrom host_floppy host_device file gluster gluster gluster gluster rbd --------------->看到这个证明升级成功
制作secret.xml文件,注意标红部分必须是2->b->i指定的名字
virsh secret-define --file secret.xml
找到刚刚定义的client.cinder用户的uuid
找到ceph提供的秘钥文件的秘钥
virsh secret-set-value $(virsh secret-list |grep client.cinder |awk '{print $1}') --base64 $(cat /etc/ceph/ceph.client.cinder.keyring |awk 'NR==2{print $3}')
vim /etc/nova/nova.conf
rbd_user=cinde
rbd_secret_uuid=dda10a4e-c03c-b029-ef07-ce86e7a07bdd ------------------>值为:virsh secret-list |grep client.cinder |awk '{print $1}
/etc/init.d/openstack-nova-compute restart
cat /etc/ceph/ceph.client.cinder.keyring
virsh secret-list
cat > secret.xml
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com