openstack Ocata--Failed to get shared write lock Is another process using the image?

openstack O版 新加了计算节点,服务正常启动,新建虚机也一切顺利,但是机器新建完成之后nova-compute.log一直重复在报以下错误:

2018-12-14 14:20:51.850 21082 ERROR nova.compute.manager Exit code: 1
2018-12-14 14:20:51.850 21082 ERROR nova.compute.manager Stdout: u''
2018-12-14 14:20:51.850 21082 ERROR nova.compute.manager Stderr: u'qemu-img: Could not open \'/var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk\': Failed to get shared "write" lock\nIs another process using the image?\n'
2018-12-14 14:20:51.850 21082 ERROR nova.compute.manager
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager [req-20a6ddf0-3ec5-4cbb-8633-73aa12512269 - - - - -] Error updating resources for node compute23.
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager Traceback (most recent call last):
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 6621, in update_available_resource_for_node
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     rt.update_available_resource(context, nodename)
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 587, in update_available_resource
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     resources = self.driver.get_available_resource(nodename)
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 5778, in get_available_resource
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     disk_over_committed = self._get_disk_over_committed_size_total()
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 7288, in _get_disk_over_committed_size_total
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     block_device_info=block_device_info)
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 7188, in _get_instance_disk_info
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     dk_size = disk_api.get_allocated_disk_size(path)
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/disk/api.py", line 158, in get_allocated_disk_size
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     return images.qemu_img_info(path).disk_size
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/images.py", line 77, in qemu_img_info
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager     raise exception.InvalidDiskInfo(reason=msg)
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager InvalidDiskInfo: Disk info file is invalid: qemu-img failed to execute on /var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk : Unexpected error while running command.
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager Command: /usr/bin/python2 -m oslo_concurrency.prlimit --as=1073741824 --cpu=30 -- env LC_ALL=C LANG=C qemu-img info /var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager Exit code: 1
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager Stdout: u''
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager Stderr: u'qemu-img: Could not open \'/var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk\': Failed to get shared "write" lock\nIs another process using the image?\n'
2018-12-14 14:21:51.843 21082 ERROR nova.compute.manager
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager [req-20a6ddf0-3ec5-4cbb-8633-73aa12512269 - - - - -] Error updating resources for node compute23.
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager Traceback (most recent call last):
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 6621, in update_available_resource_for_node
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager     rt.update_available_resource(context, nodename)
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 587, in update_available_resource
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager     resources = self.driver.get_available_resource(nodename)
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 5778, in get_available_resource
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager     disk_over_committed = self._get_disk_over_committed_size_total()
2018-12-14 14:22:51.885 21082 ERROR nova.compute.manager   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 7288, in _get_disk_over_committed_size_total
解决方法:
谷歌了一大圈终于找到问题
这个问题是因为nova管理进程在对已建虚机的硬盘文件进行定期的查看时命令qemu-img info使用没加参数-U导致,经测试以下命令就可以返回正确结果
qemu-img info -U /var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk
下面命令则返回
qemu-img info /var/lib/nova/instances/13cf63f7-bab8-4a31-990d-046120802e1f/disk
Failed to get shared "write" lock
Is another process using the image?

所以对比正常的计算节点是qemu-img-ev-2.10.0-21.el7_5.7.1.x86_64是这个版本
此有问题的节点是qemu-img-ev-2.12.0-18.el7_6.1.1.x86_64
python小白没办法定位python代码,故选择降qemu-img-ev版本
操作系统版本是centos7.4
故下载
wget http://mirror.centos.org/centos-7/7/virt/x86_64/kvm-common/qemu-img-ev-2.10.0-21.el7_5.7.1.x86_64.rpm
先停止openstack相关服务
systemctl stop openstack-nova-compute libvirtd neutron-linuxbridge-agent
rpm -e qemu-img-ev --nodeps 强制卸载qemu-img-ev
rpm -ivh qemu-img-ev-2.10.0-21.el7_5.7.1.x86_64.rpm
systemctl start openstack-nova-compute libvirtd neutron-linuxbridge-agent

观察日志,不再报错了,问题解决。

这个问题只是python代码里面一个调用shell命令少了一个参数导致的,也算是一个小bug吧,但是找了好多的资料才发现!

你可能感兴趣的:(openstack Ocata--Failed to get shared write lock Is another process using the image?)