Bug 723922

Summary: [lvm] same exit status for different errors on pvcreate command
Product: Red Hat Enterprise Linux 6 Reporter: Haim <hateya>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
Status: CLOSED WONTFIX QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2CC: agk, dwysocha, heinzm, jbrassow, mbroz, mgoldboi, prajnoha, prockai, thornber, yeylon, ykaul, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 15:14:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Haim 2011-07-21 14:49:58 UTC
Description of problem:

several permutations of pvcreate command: 

create pv which is already created:

[root@nott-vds5 ~]# pvcreate /dev/mapper/1IET_00010001 --metadatasi 1m -M 2
  Can't initialize physical volume "/dev/mapper/1IET_00010001" of volume group "VGscale" without -ff

[root@nott-vds5 ~]# echo $?
5

create pv with wrong device:

[root@nott-vds5 ~]# pvcreate /dev/mapper/1IET_00010
  Device /dev/mapper/1IET_00010 not found (or ignored by filtering).


[root@nott-vds5 ~]# echo $?
5

in case i want to build a script or a login parsing error code i might be in trouble.

Comment 2 Alasdair Kergon 2011-07-21 15:14:05 UTC
We decided in the beginning not to attempt to create and maintain an exhaustive list of failure codes.  We have two basic codes - one for a problem parsing or understanding the command line, the other for any other type of real failure.

If your script needs to distinguish different failure cases, it needs to check each of them one-by-one itself.  'pvs' helps if you need to check lvm things individually.

This isn't something we've any plans to change, I'm afraid.