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 1224018 - The disk pool alloc information are wrong after the new volume created
Summary: The disk pool alloc information are wrong after the new volume created
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-22 02:01 UTC by Yang Yang
Modified: 2015-11-19 06:36 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.16-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:36:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Yang Yang 2015-05-22 02:01:00 UTC
Description of problem:
The disk pool allocation set to the allocation of the "current" partition

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a disk pool
# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     0.00 B
Available:      996.19 MiB

2. create a primary partition
[root@rhel7_test yy]# virsh vol-create-as disk sdc1 200M
Vol sdc1 created

check pool info
[root@rhel7_test yy]# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     200.48 MiB
Available:      795.70 MiB

3. create a new primary partition
[root@rhel7_test yy]# virsh vol-create-as disk sdc2 200M
Vol sdc2 created

check pool info
[root@rhel7_test yy]# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     200.51 MiB      ==========> alloc still 200M
Available:      595.19 MiB

# virsh pool-refresh disk
Pool disk refreshed

[root@rhel7_test yy]# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     401.00 MiB     ===========> alloc is right after pool-refresh
Available:      595.19 MiB

4. create an extended partition
# virsh vol-create-as disk sdc3 200M --format extended
Vol sdc3 created

check pool info
# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     0.00 B    =====> alloc is 0 after creating extended partition
Available:      595.16 MiB

# virsh pool-refresh disk
Pool disk refreshed

[root@rhel7_test yy]# virsh pool-info disk
Name:           disk
UUID:           b0b3c21e-31df-44d0-913e-f8f7bda080d1
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       996.22 MiB
Allocation:     401.00 MiB 
Available:      595.16 MiB


# parted /dev/sdc
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Alcor Flash Disk (scsi)
Disk /dev/sdc: 1048MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type      File system  Flags
 1      32.3kB  210MB  210MB  primary
 2      210MB   421MB  210MB  primary
 3      421MB   631MB  210MB  extended               lba

Actual results:


Expected results:
fix it

Additional info:

Comment 2 John Ferlan 2015-05-23 13:40:44 UTC
Posted a patch upstream to resolve this:

http://www.redhat.com/archives/libvir-list/2015-May/msg00865.html

Comment 3 John Ferlan 2015-05-28 17:49:22 UTC
Patch was pushed upstream:

commit 6839b08ba1e5e6dfe58d43a933d740198518e49d
Author: John Ferlan <jferlan>
Date:   Thu May 21 21:10:56 2015 -0400

    storage: Fix problem with disk backend pool allocation calculation

    The disk pool recalculates the pool allocation, capacity, and available
    values each time through processing a newly created disk partition. This
    created an issue with the allocation setting since the code used is shared
    with the refresh path. Each path calls virStorageBackendDiskReadPartitions
    which initializes the pool values and then processes the partition table
    from the 'libvirt_parthelper' utility output with the only difference being
    create passes a specific volume to be processed while refresh pass a NULL
    indicating to process all volumes. That passed volume is check during the
    virStorageBackendDiskMakeVol call to see if the current partition described
    by the volume key already exists. If it exists, then no adjustments are
    made to the allocation and the next entry in the output is checked.
    
    For the create path this resulted in only the most recently created
    partition size would be accounted for in the 'allocation' setting. This
    patch thus checks whether the incoming volume is NULL before clearing
    the pool allocation value.


git describe 6839b08ba1e5e6dfe58d43a933d740198518e49d
v1.2.16-rc1-16-g6839b08

Comment 5 yisun 2015-07-22 07:38:43 UTC
PASS
Verified on libvirt-1.2.17-2.el7.x86_64

Please note, per bz 1206521 comment 8, extended disk won't take up pool's allocated space. 

Steps:
1. # cat disk.pool 
<pool type='disk'>
<name>sdb</name>
<source>
<device path='/dev/sdb'>
</device>
<format type='dos'/>
</source>
<target>
<path>/dev</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

2. #virsh pool-define disk.pool; virsh pool-build sdb; virsh pool-start sdb
3. # virsh pool-info sdb
Name:           sdb
UUID:           0d5e0da6-db87-4a93-975e-4d3467a64d4a
State:          running
Persistent:     yes
Autostart:      no
Capacity:       7.45 GiB
Allocation:     0.00 B
Available:      7.45 GiB

4. # virsh vol-create-as sdb sdb1 2G  <=== create a primary partition
Vol sdb1 created

5. # virsh pool-info sdb
Name:           sdb
UUID:           0d5e0da6-db87-4a93-975e-4d3467a64d4a
State:          running
Persistent:     yes
Autostart:      no
Capacity:       7.45 GiB
Allocation:     2.00 GiB  <=== expected
Available:      5.45 GiB

6. # virsh vol-create-as sdb sdb2 2G  <=== create another partition
Vol sdb2 created

7. # virsh pool-info sdb
Name:           sdb
UUID:           0d5e0da6-db87-4a93-975e-4d3467a64d4a
State:          running
Persistent:     yes
Autostart:      no
Capacity:       7.45 GiB
Allocation:     4.00 GiB    <==== expected
Available:      3.45 GiB

8. #  virsh vol-create-as sdb sdb3 1G --format extended  <=== create a extended partition
Vol sdb3 created

9. # virsh pool-info sdb
Name:           sdb
UUID:           0d5e0da6-db87-4a93-975e-4d3467a64d4a
State:          running
Persistent:     yes
Autostart:      no
Capacity:       7.45 GiB
Allocation:     4.00 GiB  <==== extended partition won't take up allocation as expected
Available:      3.45 GiB

10. # virsh vol-list --details sdb
 Name  Path       Type   Capacity  Allocation
----------------------------------------------
 sdb1  /dev/sdb1  block  2.00 GiB    2.00 GiB
 sdb2  /dev/sdb2  block  2.00 GiB    2.00 GiB
 sdb3  /dev/sdb3  block  1.00 GiB    1.00 GiB  <===== extended partition can be viewed here as expected. 


NB. there is a bug for prated bz 1245144 which may cause some error message during vol-create-as, but partitions could be successfully created.

Comment 7 errata-xmlrpc 2015-11-19 06:36:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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