RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 651445 - kickstarts 'logvol --percent' generates traceback on for unknown attribute 'vgFree'
Summary: kickstarts 'logvol --percent' generates traceback on for unknown attribute 'v...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: anaconda
Version: 6.0
Hardware: All
OS: Linux
low
high
Target Milestone: rc
: ---
Assignee: Chris Lumens
QA Contact: Martin Banas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-09 15:39 UTC by John Ruemker
Modified: 2018-11-14 16:38 UTC (History)
2 users (show)

Fixed In Version: anaconda-13.21.84-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 12:52:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch to partitioning.py to correct reference to unused 'vg.vgFree" (630 bytes, patch)
2010-11-09 15:39 UTC, John Ruemker
no flags Details | Diff
updates image with proposed patch (124.04 KB, application/x-gzip)
2010-11-09 15:52 UTC, John Ruemker
no flags Details
new patch (800 bytes, patch)
2010-11-09 18:21 UTC, John Ruemker
no flags Details | Diff
updated updates image with 2nd patch (124.07 KB, application/octet-stream)
2010-11-09 18:23 UTC, John Ruemker
no flags Details
new patch (inclusive of previous) that accounts for --percent and --recommended together in same vg (3.64 KB, patch)
2010-12-09 15:55 UTC, John Ruemker
no flags Details | Diff
new updates image with latest patch (135.87 KB, application/x-gzip)
2010-12-09 15:56 UTC, John Ruemker
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0530 0 normal SHIPPED_LIVE anaconda bug fix and enhancement update 2011-05-18 17:44:52 UTC

Description John Ruemker 2010-11-09 15:39:30 UTC
Created attachment 459149 [details]
patch to partitioning.py to correct reference to unused 'vg.vgFree"

Description of problem: When trying to create a lv using --percent:

  logvol / --fstype=ext4 --name=LogVol01 --vgname=vg_dhcp52138 --size=1 --grow --percent=90

a traceback is thrown:

anaconda 13.21.82 exception report
Traceback (most recent call first):
  File "/usr/lib/anaconda/storage/partitioning.py", line 1727, in growLVM
    grow = portion * vg.vgFree
  File "/usr/lib/anaconda/storage/partitioning.py", line 233, in doAutoPartition
    growLVM(anaconda.id.storage)
  File "/usr/lib/anaconda/dispatch.py", line 208, in moveStep
    rc = stepFunc(self.anaconda)
  File "/usr/lib/anaconda/dispatch.py", line 126, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/dispatch.py", line 231, in currentStep
    self.gotoNext()
  File "/usr/lib/anaconda/gui.py", line 1371, in setScreen
    (step, anaconda) = self.anaconda.dispatch.currentStep()
  File "/usr/lib/anaconda/gui.py", line 1550, in setup_window
    self.setScreen()
  File "/usr/lib/anaconda/gui.py", line 1563, in run
    self.setup_window(runres)
  File "/usr/lib/anaconda/gui.py", line 1288, in run
    self.icw.run (self.runres)
  File "/usr/bin/anaconda", line 1115, in <module>
    anaconda.intf.run(anaconda)
AttributeError: 'LVMVolumeGroupDevice' object has no attribute 'vgFree'


From storage/partitioning.py:

        # This first loop is to calculate percentage-based growth
        # amounts. These are based on total free space.
        lvs = vg.lvs
        lvs.sort(cmp=lvCompare)
        for lv in lvs:
            if not lv.req_grow or not lv.req_percent:
                continue

            portion = (lv.req_percent * 0.01)
            grow = portion * vg.vgFree

However there is no vg.vgFree.  This should be vg.freeSpace.  I've tested an updates image with this change and it corrects the problem.  patch attached.

Version-Release number of selected component (if applicable): 13.21.81.-1

How reproducible: Always, with the above kickstart line

Steps to Reproduce:
1. Create a kickstart using the logvol --percent option like so: http://johnny5.usersys.redhat.com/docs/files/rhel6-freespace.ks
2. Kickstart system
  
Actual results: Traceback

Expected results: Logvol is created with specified percentage, and installation completes

Additional info: I've marked this as high severity because (as my customer pointed out), usage of this option will likely become much more common with the addition of snapshot merge functionality.  Many people will be looking to leave extra space in their volume group for snapshots, and this is the easiest way to do so.

On a side note, the anaconda documentation is very misleading on the usage of this option, and I am filing a bug against that as well.

Comment 1 John Ruemker 2010-11-09 15:52:05 UTC
Created attachment 459153 [details]
updates image with proposed patch

Attaching the updates image if anyone wants it.

Comment 2 RHEL Program Management 2010-11-09 15:59:52 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.

Comment 3 John Ruemker 2010-11-09 17:30:51 UTC
=== In Red Hat Customer Portal Case 00368394 ===
--- Comment by Ruemker, John on 11/9/2010 12:30 PM ---

Actually, on closer inspection, the --percent option did not do what it was supposed to, even with the patch.  The installation proceeded past the point where it normally bombed out, and completed, but the lv takes the entire vg. 

  --- Volume group ---
  VG Name               vg_dhcp52138
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               9.80 GiB
  PE Size               4.00 MiB
  Total PE              2509
  Alloc PE / Size       2509 / 9.80 GiB
  Free  PE / Size       0 / 0   
  VG UUID               l3HFI4-zP33-QorK-1cC5-kVZT-FuTv-c2Mm49

  --- Logical volume ---
  LV Name                /dev/vg_dhcp52138/LogVol01
  VG Name                vg_dhcp52138
  LV UUID                BNvtFb-1Xvv-dp8A-0Kz2-bwm6-kGCO-iReftM
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                9.80 GiB
  Current LE             2509
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

Comment 4 John Ruemker 2010-11-09 18:12:47 UTC
=== In Red Hat Customer Portal Case 00368394 ===
--- Comment by Ruemker, John on 11/9/2010 1:12 PM ---

I see the problem.  Immediately after it grows everything, it does:

        # now there shouldn't be any free space left, but if there is we
        # should allocate it to one of the LVs
        vg_free = vg.freeSpace
        log.debug("vg %s has %dMB free" % (vg.name, vg_free))
        if vg_free:
            for lv in lvs:
                if not lv.req_grow:
                    continue

                if lv.req_max_size and lv.size == lv.req_max_size:
                    continue

                if lv.format.maxSize and lv.size == lv.format.maxSize:
                    continue

                # first come, first served
                projected = lv.size + vg.freeSpace
                if lv.req_max_size and projected > lv.req_max_size:
                    projected = lv.req_max_size

                if lv.format.maxSize and projected > lv.format.maxSize:
                    projected = lv.format.maxSize

                log.debug("giving leftover %dMB to %s" % (projected - lv.size,
                                                          lv.name))
                lv.size = projected

Obviously this doesn't allow for any leftover space.  This needs to be changed so people can leave free space in the vg.  It looks like this could easily be changed to check if this lv has a percent specified, and if so leave it alone.  Perhaps:

diff --git a/storage/partitioning.py b/storage/partitioning.py
index e12b3e3..3bf0e53 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -1798,6 +1798,9 @@ def growLVM(storage):
                 if not lv.req_grow:
                     continue
 
+                if lv.req_percent > 0:
+                    continue
+
                 if lv.req_max_size and lv.size == lv.req_max_size:
                     continue

I just tested this and it did what I expected to after applying this. 

Should this go in another bug? 

-John

Comment 6 John Ruemker 2010-11-09 18:21:20 UTC
Created attachment 459203 [details]
new patch

This patch is inclusive of the previous, and includes a proposed fix for the fact that even with a percent specified, anaconda will grow the lv to take up remaining space in the vg.  When checking for eligible lvs to take up the remaining space, this simply skips the lv if percent > 0.  This could probably be more graceful to see if the percent is somewhere near the size, but I couldn't think of a good way to implement that logic.

Comment 7 John Ruemker 2010-11-09 18:23:19 UTC
Created attachment 459204 [details]
updated updates image with 2nd patch

Comment 8 Chris Lumens 2010-12-06 18:23:13 UTC
Thanks for the patch.  This will be included in the next build of anaconda.

Comment 9 Chris Lumens 2010-12-08 15:58:16 UTC
updates=http://clumens.fedorapeople.org/percent.img

Comment 12 John Ruemker 2010-12-09 15:55:35 UTC
Created attachment 467772 [details]
new patch (inclusive of previous) that accounts for --percent and --recommended together in same vg

I've tested this patch and it does solve the issues described in the last few comments.  It does so using the logic I described in my last comment.  Specifically, if there is any lv in the vg that uses --percent, it skips the step where it dishes out any remaining space to logvols with --grow.

Comment 13 John Ruemker 2010-12-09 15:56:46 UTC
Created attachment 467773 [details]
new updates image with latest patch

Comment 16 Martin Banas 2011-04-05 06:54:11 UTC
VERIFIED on RHEL6.1-20110330.2 with following kickstart file: http://file.brq.redhat.com/~mbanas/651445.cfg . 
I reproduced the bug on RHEL6.0 and verified it's fixed on RHEL6.1-20110330.2.

Comment 17 errata-xmlrpc 2011-05-19 12:52:50 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-0530.html

Comment 18 errata-xmlrpc 2011-05-19 12:52:51 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-0530.html


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