Bug 672617

Summary: [RFE] improve error message when lvcreate fails to create an LV (snapshot or otherwise).
Product: Red Hat Enterprise Linux 6 Reporter: Mike Khusid <mkhusid>
Component: lvm2Assignee: Mike Snitzer <msnitzer>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: agk, cww, dwysocha, heinzm, jantill, jbrassow, jofernan, lvm-team, mbroz, msnitzer, prajnoha, prockai, zkabelac
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.82-1.el6 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 669178 Environment:
Last Closed: 2011-05-19 14:27:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 655920, 669178    

Comment 1 Mike Snitzer 2011-01-25 18:30:12 UTC
Improve this error:
Insufficient free extents (511) in volume group vg_jrummy: 512 required

To something like:
Insufficient free extents (511) in volume group vg_jrummy: 512 required
Unable to create snapshot logical volume lv_root_yum_20110120093209

(lvm2 cannot eliminate the yum plugin's file descriptor leaks.. but they
contribute to the noise that is making this failure harder for the user to understand)

Comment 3 Mike Snitzer 2011-01-25 23:15:38 UTC
I'm not convinced we need or want this change.

Users have expressed concern with the cryptic nature of some lvcreate
failures, e.g. insufficient free space in the VG results in:

# lvcreate -n testlv -L 5g test
  Insufficient free extents (1024) in volume group test: 1280 required

With this change we would get:

# lvcreate -n testlv -L 5g test
  Insufficient free extents (1024) in volume group test: 1280 required
  Unable to create logical volume testlv.

Could be that this new error is more noise and the fact is that the user
doesn't understand what an extent is so it is hard for them to make
sense of the _real_ problem?

So I think we need to take a step back and understand what the user found to be confusing about the failure.

Was it all the file descriptor leaks that contributed to an easily missed or misunderstood failure?

Comment 4 Mike Khusid 2011-01-25 23:28:20 UTC
IMO a error message that would more sense to me would be:

Unable to create {snapshot} logical volume testlv in volume group test: 1024 extents available, 1280 required.

Comment 5 Zdenek Kabelac 2011-01-26 09:29:59 UTC
Some error messages are printed in various level of the code - i.e. subprocedures.
Thus it's not always possible to print such message in some deep internal routine.

Current practice is - the code should print just 1 error message.

i.e. you could get error about failed memory allocation - this may lead to various other failed operation - but only primary error is printed.

Not really sure how we could easily enhance this error printing logic.

Comment 6 Alasdair Kergon 2011-01-26 12:00:03 UTC
Saying "Unable to create logical volume testlv." is pointless - adds no useful information at all: it is just repeating the command the user ran back at them!

Comment 7 Alasdair Kergon 2011-01-26 12:02:26 UTC
The phrasing of the existing message could be improved slightly (say 'free space' rather than 'free extents'), but I don't think the content needs changing.

Comment 8 Mike Khusid 2011-01-26 13:32:29 UTC
(In reply to comment #6)
> Saying "Unable to create logical volume testlv." is pointless - adds no useful
> information at all: it is just repeating the command the user ran back at them!

The first message provides only VG name, and the second provides LV name.  Ultimately, the user (esp in this use case) cares about the LV not the VG.

You are also making assumption that a user ran the command by hand.  See blocked bug -- the LV is being created by software.

Comment 9 Mike Snitzer 2011-01-28 02:59:01 UTC
(In reply to comment #8)
> Ultimately, the user (esp in this use case) cares about the LV not the VG.

Actually, in this case (bug#669178) the user _should_ care about the VG (as it is their job to provision free space in the VG to allow automated snapshot creation).

The name of the LV doesn't really matter since it wasn't created.

> You are also making assumption that a user ran the command by hand.  See
> blocked bug -- the LV is being created by software.

I decided to go with:

Volume group "test" has insufficient free space (1024 extents): 1280 required.

I could have appended "to create {snapshot} logical volume."

But really, the user doesn't need to know that (especially if the user _did_ craft the lvcreate command line).

For bug#669178 we need the user to draw the conclusion: "Oh, yum's snapshot plugin failed because I need more space in volume group $foo".

Long story short, I think this change strikes a reasonable balance.

Comment 10 Mike Khusid 2011-02-04 18:09:10 UTC
Thank you.

Comment 13 Corey Marthaler 2011-03-01 22:40:52 UTC
Fix verified in the latest rpms.

2.6.32-114.0.1.el6.x86_64

lvm2-2.02.83-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
lvm2-libs-2.02.83-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
lvm2-cluster-2.02.83-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
udev-147-2.33.el6    BUILT: Wed Feb  9 09:56:24 CST 2011
device-mapper-1.02.62-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
device-mapper-libs-1.02.62-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
device-mapper-event-1.02.62-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
device-mapper-event-libs-1.02.62-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011
cmirror-2.02.83-2.el6    BUILT: Tue Feb  8 10:10:57 CST 2011


[root@grant-01 ~]# pvscan
  PV /dev/sdb1   VG grant        lvm2 [496.00 MiB / 496.00 MiB free]
  PV /dev/sdc1   VG grant        lvm2 [496.00 MiB / 496.00 MiB free]
  PV /dev/sda2   VG vg_grant01   lvm2 [74.01 GiB / 0    free]
  Total: 3 [74.98 GiB] / in use: 3 [74.98 GiB] / in no VG: 0 [0   ]

[root@grant-01 ~]# lvcreate -m 1 -L 500M -n mirror grant
  Insufficient free space: 125 extents needed, but only 123 available
  Unable to allocate extents for mirror(s).

Comment 14 errata-xmlrpc 2011-05-19 14:27:18 UTC
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-2011-0772.html