Hide Forgot
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.
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.
(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.
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>
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.
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
Backported patches sent for internal review ([RHEL-6.5 libvirt PATCH 0/2] Fix virt-sanlock-cleanup).
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
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