Bug 1409511
| Summary: | Better error on failure to acquire lease on run VM | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Arik <ahadas> |
| Component: | libvirt | Assignee: | Jiri Denemark <jdenemar> |
| Status: | CLOSED ERRATA | QA Contact: | Han Han <hhan> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.3 | CC: | dyuan, jsuchane, libvirt-maint, nsoffer, rbalakri, teigland, xuzhang, ylavi |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.2.0-4.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-01 17:21:45 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | 1443140 | ||
| Bug Blocks: | |||
|
Description
Arik
2017-01-02 10:29:40 UTC
The -243 string seems to come from sanlock: src/sanlock_rv.h:#define SANLK_ACQUIRE_IDLIVE -243 I think what is missing is: - make it clear that the issue is failing to acquire a lease - provide the lease id (target path:offset, or lockspace:key) so a management application can report back a good error. - provide a reason why the acquire failed - here sanlock provided an error code that can be used to provide a pretty message. David, can sanlock provide a good error message with the error code in this case? Comparing the errno and strerror(), you would expect a system to provide both an error code and a clear message for each error code. Can Vdsm assume that getting VIR_ERR_RESOURCE_BUSY error for a vm with a lease is always a failure to acquire the lease? or there are other unrelated failures reported using the same error code? I'll add sanlock_strerror() to the lib. As for the comment 3, I would say yes, it should be reliable. At least it was subject of bug 1165119. Jirka Denemark can comment. (In reply to Nir Soffer from comment #3) > Can Vdsm assume that getting VIR_ERR_RESOURCE_BUSY error for a vm with a > lease is always a failure to acquire the lease? Ideally you should check the error domain too. That is, if you see a VIR_ERR_RESOURCE_BUSY error and its domain is either VIR_FROM_LOCKING or VIR_FROM_LOCKSPACE, libvirt was unable to acquire the lease. *** Bug 1443153 has been marked as a duplicate of this bug. *** Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2017-April/msg00842.html Support for sanlock_strerror is implemented upstream by
commit 23377c539b72a7fc4e2749a068711fe1f626998d
Refs: v3.2.0-271-g23377c539
Author: Jiri Denemark <jdenemar>
AuthorDate: Fri Mar 31 21:42:22 2017 +0200
Commit: Jiri Denemark <jdenemar>
CommitDate: Thu Apr 27 11:44:11 2017 +0200
locking: Add support for sanlock_strerror
The recently added sanlock_strerror function can be used to translate
sanlock's numeric errors into human readable strings.
https://bugzilla.redhat.com/show_bug.cgi?id=1409511
Signed-off-by: Jiri Denemark <jdenemar>
Since triggering all error types is complex and the codes structures are similar I will use one error to verify the bug. And I will try to trigger more errors later.
Verify it on libvirt-3.2.0-9.el7.x86_64 sanlock-3.5.0-1.el7.x86_64
1. Set following configurations:
In /etc/libvirt/qemu.conf:
lock_manager = "sanlock"
In /etc/libvirt/qemu-sanlock.conf:
user = "sanlock"
group = "sanlock"
host_id = 1
auto_disk_leases = 0
disk_lease_dir = "/var/lib/libvirt/sanlock"
require_lease_for_disks = 1
2. Run this script to manually create lockspace and resource files.
#!/bin/bash -x
DOM=avocado-vt-vm1
lockspace_name=libvirt-sanlock
lockspce_resource_path=/var/lib/libvirt/sanlock/libvirt-sanlock
resource_name=test-disk-resource-lock
resource_offset=1048576
truncate -s 2M $lockspce_resource_path
chown sanlock:sanlock $lockspce_resource_path
sanlock direct init -s $lockspace_name:0:$lockspce_resource_path:0
sanlock add_lockspace -s $lockspace_name:1:$lockspce_resource_path:0
sanlock direct init -r $lockspace_name:$resource_name:$lockspce_resource_path:$resource_offset
restorecon -R -v /var/lib/libvirt/sanlock
3. Use fault key and add lease xml to VM:
<lease>
<lockspace>libvirt-sanlock</lockspace>
<key>fault</key>
<target path='/var/lib/libvirt/sanlock/libvirt-sanlock' offset='1048576'/>
</lease>
4. Try to start VM
In RHEL7.3, I got:
# virsh start avocado-vt-vm1
error: Failed to start domain avocado-vt-vm1
error: resource busy: Failed to acquire lock: error -227
In RHEL7.4, I got:
# virsh start V
error: Failed to start domain V
error: resource busy: Failed to acquire lock: Lease resource name is incorrect
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. https://access.redhat.com/errata/RHEA-2017:1846 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. https://access.redhat.com/errata/RHEA-2017:1846 |