Description of problem:
When libvirt fails to start the VM because it fials the acquire the lock, it returns VIR_ERR_INTERNAL_ERROR which is too broad to be handled in some meaningful way.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Currently, libvirt would report "internal error Failed to acquire lock: error -243"
Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2015-April/msg00585.html
Fixed upstream by v1.2.14-161-g4864e37:
Author: Jiri Denemark <email@example.com>
Date: Tue Apr 14 16:27:37 2015 +0200
sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails
When acquiring resource via sanlock fails, we would report it as
VIR_ERR_INTERNAL_ERROR, which is not very friendly to applications using
libvirt. Moreover, the lockd driver would report the same failure as
VIR_ERR_RESOURCE_BUSY, which looks better.
Unfortunately, in sanlock driver we don't really know if acquiring the
resource failed because it was already locked or there was another
reason behind. But the end result is the same and I think using
VIR_ERR_RESOURCE_BUSY reason for all acquire failures is still better
than what we have now.
Signed-off-by: Jiri Denemark <firstname.lastname@example.org>
I can reproduce it on libvirt-1.2.8-10.el7.x86_64
Verified on libvirt-1.2.16-1.el7.x86_64
1. prepare 2 hosts, edit following conf file
# grep "lock_manager" /etc/libvirt/qemu.conf
lock_manager = "sanlock"
# vim /etc/libvirt/qemu-sanlock.conf
auto_disk_leases = 1
disk_lease_dir = "/var/lib/libvirt/sanlock"
host_id = 1 (host_id = 2 on 2nd host)
user = "sanlock"
group = "sanlock"
# getsebool -a
sanlock_use_nfs --> on
virt_use_sanlock --> on
virt_use_nfs --> on
#mount 10.66.4.164:/yy/nfs /var/lib/libvirt/sanlock
#service sanlock start
#service libvirtd restart
2. define/start a guest on 2 hosts with following xml
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
start the guest on host 1
# virsh start simple
Domain simple started
start the guest on host2
# virsh start simple
error: Failed to start domain simple
error: resource busy: Failed to acquire lock: error -243
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.