Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1000890

Summary: met error when run virt-sanlock-clean.
Product: Red Hat Enterprise Linux 6 Reporter: Shanzhi Yu <shyu>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5CC: ajia, dyuan, icon, jdenemar, lsu, mzhan, rbalakri
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-32.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 04:16:58 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:

Description Shanzhi Yu 2013-08-26 04:03:12 UTC
Description of problem:
met error when run virt-sanlock-clean. Maybe it is caused by augeas.

test with augeas-0.9.0-4.el6.x86_64/sanlock-2.6-2.el6.x86_64,
[root@shyu_work_pc ~]# LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
[root@shyu_work_pc ~]# echo $?
1

while test with augeas-1.0.0-5.el6.x86_64/sanlock-2.8-1.el6.x86_64
[root@shyu_work_pc ~]# LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
[root@shyu_test_pc ~]# echo $?
0

....
13 LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
14 if test $? != 0 || "x$LOCKDIR" = "x" ; then
15   LOCKDIR="/var/lib/libvirt/sanlock"
16 fi
....
28 cd "$LOCKDIR" || exit 1

Version-Release number of selected component (if applicable):

libvirt-0.10.2-23.el6.x86_64
sanlock-2.8-1.el6.x86_64
libvirt-lock-sanlock-0.10.2-23.el6.x86_64
augeas-1.0.0-5.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Config about libvirt
# tail -1 /etc/libvirt/qemu-sanlock.conf 
user = "sanlock"
group = "sanlock"
host_id = 1
auto_disk_leases = 1
disk_lease_dir = "/var/lib/libvirt/sanlock"

# tail -1 /etc/libvirt/qemu.conf 
lock_manager = "sanlock"

2.
Prepare a shutdown guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     test                           shut off

3.Start related service
# service wdmd start
# service sanlock start
# service libvirtd start
#ll /var/lib/libvirt/sanlock

-rw-r-----. 1 sanlock sanlock 1048576 Aug 26 11:23  __LIBVIRT__DISKS__

#virsh start test

4.
# ll /var/lib/libvirt/sanlock/
total 1024
-rw-------. 1 sanlock sanlock 1048576 Aug 26 11:23  f30a79d7d4b9c375cf1b1a5feb8e8e1f
-rw-rw----. 1 sanlock sanlock 1048576 Aug 26 11:23 __LIBVIRT__DISKS__


5.
#virt-sanlock-clean
/usr/sbin/virt-sanlock-cleanup: line 14: x/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir = "/var/lib/libvirt/sanlock": No such file or directory
/usr/sbin/virt-sanlock-cleanup: line 28: cd: /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir = "/var/lib/libvirt/sanlock": No such file or directory


Actual results:
as above

Expected results:
no error

Additional info:
on rhel6.4 with augeas-0.9.0-4.el6.x86_64/sanlock-2.6-2.el6.x86_64, there is no error.

Comment 2 Jiri Denemark 2013-08-27 10:14:08 UTC
There are two bugs involved. The first one is a regression in augeas and the second one is a bug in virt-sanlock-clean. I'll clone this bug for augeas.

Comment 3 Alex Jia 2013-08-27 10:21:24 UTC
(In reply to Jiri Denemark from comment #2)
> There are two bugs involved. The first one is a regression in augeas and the
> second one is a bug in virt-sanlock-clean. I'll clone this bug for augeas.

BTW, I have ever committed a patch for augeas, but no reply from augeas-devel listing.

Comment 4 Jiri Denemark 2013-08-27 10:53:39 UTC
The libvirt bug is fixed upstream by commit v1.0.4-98-gc3e33e6:

commit c3e33e68d9785028d96be42162001d306c9b6915
Author: Alex Jia <ajia>
Date:   Mon Apr 8 17:41:50 2013 +0800

    sanlock: add missing test command in virt-sanlock-cleanup.in
    
    RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=949483
    
    Signed-off-by: Alex Jia <ajia>

Comment 5 Jiri Denemark 2013-08-27 11:04:44 UTC
Hmm actually there is no regression in augeas. It most likely worked with older augeas because disk_lease_dir was not set in /etc/libvirt/qemu-sanlock.conf. If it is set, the result of augtool print /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir' is the same with both versions of augeas. Unfortunately, the output is not compatible with the way virt-sanlock-clean script is using it. Thus the first bug is also in libvirt.

Comment 6 Jiri Denemark 2013-08-28 12:56:03 UTC
The other libvirt bug is now fixed upstream by v1.1.1-248-g74c5156:

commit 74c5156f9db3be51eb7431a84f32731e7f687f2c
Author: Jiri Denemark <jdenemar>
Date:   Wed Aug 28 13:50:10 2013 +0200

    virt-sanlock-cleanup; Fix augtool usage
    
    Surprisingly, augtool get (or print) returns "path = value" while we are
    only interested in the value. We need to remove the "path = " part from
    the augtool's output. The following is an example of the augtool command
    as used in virt-sanlock-cleanup script:
    
    $ augtool get /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir
    /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir = /var/lib/libvirt/sanlock

Comment 7 Jiri Denemark 2013-08-28 13:26:52 UTC
Backported patches sent for internal review ([RHEL-6.5 libvirt PATCH 0/2] Fix virt-sanlock-cleanup).

Comment 13 Luwen Su 2014-04-21 02:52:06 UTC
Test basing on below , and VERFIED
libvirt-0.10.2-33.el6.x86_64
sanlock-2.8-1.el6.x86_64
augeas-1.0.0-5.el6_5.1.x86_64

1.Prepare steps same as #comment 0
2.
#virsh list 
 Id    Name                           State
----------------------------------------------------
 2     test                           running


#ll /var/lib/libvirt/sanlock/
total 2048
-rw-------. 1 sanlock sanlock 1048576 Apr 21 10:46 f30a79d7d4b9c375cf1b1a5feb8e8e1f
-rw-r-----. 1 sanlock sanlock 1048576 Apr 21 10:46 __LIBVIRT__DISKS__

#sanlock client status
daemon 4b8373e6-1d2a-4f87-bb0d-97dfdea74e6e.localhost.
p -1 helper
p -1 listener
p 13927 test
p -1 status
s __LIBVIRT__DISKS__:1:/var/lib/libvirt/sanlock/__LIBVIRT__DISKS__:0
r __LIBVIRT__DISKS__:f30a79d7d4b9c375cf1b1a5feb8e8e1f:/var/lib/libvirt/sanlock/f30a79d7d4b9c375cf1

3.
#virt-sanlock-cleanup 
Cleanup: __LIBVIRT__DISKS__:f30a79d7d4b9c375cf1b1a5feb8e8e1f:/var/lib/libvirt/sanlock/f30a79d7d4b9c375cf1b1a5feb8e8e1f:0 register
register done 3
acquire fd 3
acquire done 0
PASS

#sanlock client status
daemon 4b8373e6-1d2a-4f87-bb0d-97dfdea74e6e.localhost.
p -1 helper
p -1 listener
p -1 status
s __LIBVIRT__DISKS__:1:/var/lib/libvirt/sanlock/__LIBVIRT__DISKS__:0
# ll /var/lib/libvirt/sanlock/
total 1024
-rw-r-----. 1 sanlock sanlock 1048576 Apr 21 10:46 __LIBVIRT__DISKS__

# echo $?
0

Comment 15 errata-xmlrpc 2014-10-14 04:16:58 UTC
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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html