OpenStack如何修改Cinder后端存储的卷信息

    公司面临着Glusterfs的迁移工作,原OpenStack都是连接的192.168.0.3上面的Glusterfs的volume。现在需要更换IP,发现硬重启云主机,并不会自动进行volume的变动,于是查看源码,确认生成libvirtxml的时候从哪里取的卷。vim /usr/lib/python2.6/site-packages/nova/virt/libvirt/volume.py 发现会从nova数据库的block_device_mapping表中取connection_info,好吧,继续暴力一次,直接update一下。
update nova.block_device_mapping set connection_info='{"driver_volume_type": "glusterfs", "mount_point_base": "/var/lib/cinder/mnt", "serial": "484c287a-0e1b-46cb-a7e0-5a626e2c632e", "data": {"device_path": "/var/lib/nova/mnt/b6c2ec525d0123967968d0b115df02fd/volume-484c287a-0e1b-46cb-a7e0-5a626e2c632e", "name": "volume-484c287a-0e1b-46cb-a7e0-5a626e2c632e", "format": "raw", "qos_specs": null, "export": "192.168.0.1:/cinder-volume", "access_mode": "rw", "options": null}}' where instance_uuid='d897bf7e-e95a-4d73-a6f3-8b1c8a794d3e' and volume_id='484c287a-0e1b-46cb-a7e0-5a626e2c632e';


update nova.block_device_mapping set connection_info='{"driver_volume_type": "glusterfs", "mount_point_base": "/var/lib/cinder/mnt", "serial": "6caf9478-365d-41b1-9997-f92ccf47c0ff", "data": {"device_path": "/var/lib/nova/mnt/b6c2ec525d0123967968d0b115df02fd/volume-6caf9478-365d-41b1-9997-f92ccf47c0ff", "name": "volume-6caf9478-365d-41b1-9997-f92ccf47c0ff", "format": "raw", "qos_specs": null, "export": "192.168.0.1:/cinder-volume", "access_mode": "rw", "options": null}}' where instance_uuid='d897bf7e-e95a-4d73-a6f3-8b1c8a794d3e' and volume_id='6caf9478-365d-41b1-9997-f92ccf47c0ff';
      把每台云主机的每个卷都update一下,然后硬重启,nova会重新生成新的libvrit.xml。然后你发现,变成了你想要的样子了,不说了,继续搬砖。有机会好好研究研究源码,现在事情太多。

0 个评论

要回复文章请先登录注册