[libvirt] [PATCH] 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> --- In fact, the virt-sanlock-cleanup works well on RHEL6.4, but doesn't work on RHEL7.0, and got a error "line 14: x: command not found", It may be different bash version issue. tools/virt-sanlock-cleanup.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virt-sanlock-cleanup.in b/tools/virt-sanlock-cleanup.in index a9b7c2e..5389fc7 100644 --- a/tools/virt-sanlock-cleanup.in +++ b/tools/virt-sanlock-cleanup.in @@ -11,7 +11,7 @@ fi LOCKSPACE="__LIBVIRT__DISKS__" LOCKDIR=`augtool print '/files@sysconfdir@/libvirt/qemu-sanlock.conf/disk_lease_dir'` -if test $? != 0 || "x$LOCKDIR" = "x" ; then +if test $? != 0 || test "x$LOCKDIR" = "x" ; then LOCKDIR="@localstatedir@/lib/libvirt/sanlock" fi -- 1.7.1

On 04/08/2013 03:46 AM, Alex Jia wrote:
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=949483
Signed-off-by: Alex Jia <ajia@redhat.com> --- In fact, the virt-sanlock-cleanup works well on RHEL6.4, but doesn't work on RHEL7.0, and got a error "line 14: x: command not found", It may be different bash version issue.
It has nothing to do with bash versions; rather, it is a result of $LOCKDIR being non-empty on the machine where it "worked" (and/or augtool exiting with nonzero status), vs. being empty on the machine where it failed (with augtool existing with zero status). Which makes it more a question of what changed in augtool, or in the files that augtool was inspecting, between the two machines.
tools/virt-sanlock-cleanup.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virt-sanlock-cleanup.in b/tools/virt-sanlock-cleanup.in index a9b7c2e..5389fc7 100644 --- a/tools/virt-sanlock-cleanup.in +++ b/tools/virt-sanlock-cleanup.in @@ -11,7 +11,7 @@ fi LOCKSPACE="__LIBVIRT__DISKS__"
LOCKDIR=`augtool print '/files@sysconfdir@/libvirt/qemu-sanlock.conf/disk_lease_dir'` -if test $? != 0 || "x$LOCKDIR" = "x" ; then +if test $? != 0 || test "x$LOCKDIR" = "x" ; then
At any rate, this fix is correct. ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 04/09/2013 04:16 AM, Eric Blake wrote:
On 04/08/2013 03:46 AM, Alex Jia wrote:
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=949483
Signed-off-by: Alex Jia<ajia@redhat.com> --- In fact, the virt-sanlock-cleanup works well on RHEL6.4, but doesn't work on RHEL7.0, and got a error "line 14: x: command not found", It may be different bash version issue. It has nothing to do with bash versions; rather, it is a result of $LOCKDIR being non-empty on the machine where it "worked" (and/or augtool exiting with nonzero status), vs. being empty on the machine where it failed (with augtool existing with zero status). Which makes it more a question of what changed in augtool, or in the files that augtool was inspecting, between the two machines.
I just double checked this, it should be a augeas's bug, whether or not the "disk_lease_dir" is configured in /etc/libvirt/qemu-sanlock.conf, the augtool always exit with zero status on augeas-1.0.0-1.fc18.x86_64 or augeas-1.0.0-1.el7.x86_64: # grep "disk_lease_dir =" /etc/libvirt/qemu-sanlock.conf #disk_lease_dir = "/var/lib/libvirt/sanlock" # sh -x test.sh ++ augtool print /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir + LOCKDIR= + test 0 '!=' 0 + x = x test.sh: line 2: x: command not found
tools/virt-sanlock-cleanup.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virt-sanlock-cleanup.in b/tools/virt-sanlock-cleanup.in index a9b7c2e..5389fc7 100644 --- a/tools/virt-sanlock-cleanup.in +++ b/tools/virt-sanlock-cleanup.in @@ -11,7 +11,7 @@ fi LOCKSPACE="__LIBVIRT__DISKS__"
LOCKDIR=`augtool print '/files@sysconfdir@/libvirt/qemu-sanlock.conf/disk_lease_dir'` -if test $? != 0 || "x$LOCKDIR" = "x" ; then +if test $? != 0 || test "x$LOCKDIR" = "x" ; then At any rate, this fix is correct. ACK.
Thanks and pushed now.
participants (2)
-
Alex Jia
-
Eric Blake