Bug 476692 - vgdisplay returns wrong status code when requested VG not found
vgdisplay returns wrong status code when requested VG not found
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2 (Show other bugs)
4.7
All Linux
medium Severity medium
: rc
: ---
Assigned To: Dave Wysochanski
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-16 10:51 EST by Milan Broz
Modified: 2013-02-28 23:07 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-18 16:10:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Milan Broz 2008-12-16 10:51:58 EST
+++ This bug was initially created as a clone of Bug #470560 +++
RHEL4 clone

Error status from lvm commands do not reflect problems that the commands encounter with storage.    The test script attached will create a vg with two pieces of storage, an lvol, put a fs on it, and then mount it.   Artificially 'damaging' the underlying pv's will cause lvm commands to generate error messages, yet the error status is always 0. 

...
 
 vgs vgtest ; echo $?
   Couldn't find device with uuid
'B2zQYT-GTH1-6vde-AqdS-CQMy-hLoL-kYh12q'.
   Couldn't find all physical volumes for volume group vgtest.
   Couldn't find device with uuid
'B2zQYT-GTH1-6vde-AqdS-CQMy-hLoL-kYh12q'.
   Couldn't find all physical volumes for volume group vgtest.
   Volume group "vgtest" not found
 5   <<<<< proper return status
   
   
 vgdisplay -v vgtest ; echo $?
     Using volume group(s) on command line
     Finding volume group "vgtest"
     Wiping cache of LVM-capable devices
   Couldn't find device with uuid
'B2zQYT-GTH1-6vde-AqdS-CQMy-hLoL-kYh12q'.
   Couldn't find all physical volumes for volume group vgtest.
   Couldn't find device with uuid
'B2zQYT-GTH1-6vde-AqdS-CQMy-hLoL-kYh12q'.
   Couldn't find all physical volumes for volume group vgtest.
   Volume group "vgtest" not found
 0  <<<< incorrect return status


--- Additional comment from dwysocha@redhat.com on 2008-11-07 14:04:59 EDT ---

Thanks for reporting.  Confirmed vgdisplay exit code bug (looks like it's been there a long time, not a recent regression).  Also confirmed lvdisplay and pvdisplay do not have this bug.  Simple fix checked in upstream:
Checking in WHATS_NEW;
/cvs/lvm2/LVM2/WHATS_NEW,v  <--  WHATS_NEW
new revision: 1.991; previous revision: 1.990
done
Checking in tools/vgdisplay.c;
/cvs/lvm2/LVM2/tools/vgdisplay.c,v  <--  vgdisplay.c
new revision: 1.22; previous revision: 1.21
done
Comment 2 Milan Broz 2008-12-16 11:54:37 EST
In CVS - lvm2-2.02.42-1.el4
Comment 4 Corey Marthaler 2009-04-20 17:58:13 EDT
Fix verified in lvm2-2.02.42-5.el4.

[root@grant-01 ~]# vgdisplay -v vgtest
    Using volume group(s) on command line
    Finding volume group "vgtest"
    Wiping cache of LVM-capable devices
  Volume group "vgtest" not found
[root@grant-01 ~]# echo $?
5
Comment 6 errata-xmlrpc 2009-05-18 16:10:29 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0967.html

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