Bug 949483 - Improve the script virt-sanlock-clean
Improve the script virt-sanlock-clean
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Michal Privoznik
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-08 05:24 EDT by Luwen Su
Modified: 2014-06-17 20:47 EDT (History)
8 users (show)

See Also:
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 06:22:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Luwen Su 2013-04-08 05:24:13 EDT
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 05:49:58 EDT
Patch on upstream:
https://www.redhat.com/archives/libvir-list/2013-April/msg00596.html
Comment 3 Michal Privoznik 2013-04-09 09:33:04 EDT
Moving to POST:

commit c3e33e68d9785028d96be42162001d306c9b6915
Author:     Alex Jia <ajia@redhat.com>
AuthorDate: Mon Apr 8 17:41:50 2013 +0800
Commit:     Alex Jia <ajia@redhat.com>
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@redhat.com>

v1.0.4-98-gc3e33e6
Comment 4 Luwen Su 2013-05-07 23:55:26 EDT
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 06:22:22 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.