Bug 949483

Summary: Improve the script virt-sanlock-clean
Product: Red Hat Enterprise Linux 7 Reporter: Luwen Su <lsu>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, ajia, cwei, dyuan, eblake, mprivozn, mzhan, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.0.5-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:22:22 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 Luwen Su 2013-04-08 09:24:13 UTC
Description of problem:
I'm not sure but doubt that the bash 4.2 change the way that evaluate expression,


LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
if test $? != 0 || "x$LOCKDIR" = "x"   then    
   LOCKDIR="/var/lib/libvirt/sanlock"
fi



Version-Release number of selected component (if applicable):
libvirt-1.0.3-1.el7.x86_64
bash-4.2.45-1.el7.x86_64
sanlock-2.7-2.el7.x86_64
augeas-1.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.just run 
#virt-sanlock-clean

2.
"/usr/sbin/virt-sanlock-cleanup: line 14: x: command not found"



Additional info:
In rhel6 , the same script can success excute.

Comment 2 Alex Jia 2013-04-08 09:49:58 UTC
Patch on upstream:
https://www.redhat.com/archives/libvir-list/2013-April/msg00596.html

Comment 3 Michal Privoznik 2013-04-09 13:33:04 UTC
Moving to POST:

commit c3e33e68d9785028d96be42162001d306c9b6915
Author:     Alex Jia <ajia>
AuthorDate: Mon Apr 8 17:41:50 2013 +0800
Commit:     Alex Jia <ajia>
CommitDate: Tue Apr 9 13:01:33 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>

v1.0.4-98-gc3e33e6

Comment 4 Luwen Su 2013-05-08 03:55:26 UTC
Test with 
libvirt-1.0.5-1.el7.x86_64
bash-4.2.45-1.el7.x86_64

Before
LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
if test $? != 0 ||  "x$LOCKDIR" = "x" ; then
  LOCKDIR="/var/lib/libvirt/sanlock"
fi

test1.sh: line 2: x: command not found

Now , add test
LOCKDIR=`augtool print '/files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir'`
if test $? != 0 || test  "x$LOCKDIR" = "x" ; then
  LOCKDIR="/var/lib/libvirt/sanlock"
fi

//no error
#echo $?
0

So set it verify

Comment 5 Ludek Smid 2014-06-13 10:22:22 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.