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 1163091 - pool allocation value too large after volume creation
Summary: pool allocation value too large after volume creation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-12 11:20 UTC by Vladimir Benes
Modified: 2016-11-03 18:11 UTC (History)
9 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:11:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
self explanatory screenshot (209.68 KB, image/png)
2014-11-12 11:21 UTC, Vladimir Benes
no flags Details
libvirt-machine-props: Refresh pool after getting it (1.27 KB, patch)
2015-09-22 22:54 UTC, Zeeshan Ali
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Vladimir Benes 2014-11-12 11:20:54 UTC
Description of problem:
when creating new machine I can set absurd disk sizes. To EB or so. See screenshot. I think this was corrected when changing disk size to existing machine.

Version-Release number of selected component (if applicable):
gnome-boxes-3.8.3-11.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1.try any installtion
2.go to customize
3.set EB disk sizes

Actual results:
able

Expected results:
shouldn't be

Additional info:

Comment 1 Vladimir Benes 2014-11-12 11:21:54 UTC
Created attachment 956684 [details]
self explanatory screenshot

Comment 4 Vladimir Benes 2015-04-15 20:51:18 UTC
yes, it still is.

Comment 7 Zeeshan Ali 2015-09-10 17:03:18 UTC
Yikes, this went out of my radar. Last I recall I was not able to reproduce it but I'll give it another try. I'm PTO tomorrow so it has to be on Monday.

Comment 8 Zeeshan Ali 2015-09-15 12:56:18 UTC
Vladimir,

Assuming you can still reproduce this, is this only when customizing resources before creation or afterwards or both?

Comment 9 Vladimir Benes 2015-09-15 13:02:01 UTC
Zeeshan,
from what I can see it's just before creation.

Comment 10 Zeeshan Ali 2015-09-22 14:04:42 UTC
Yay, at least now I can reproduce this.

Comment 11 Zeeshan Ali 2015-09-22 18:01:12 UTC
(In reply to Zeeshan Ali from comment #10)
> Yay, at least now I can reproduce this.

Looking at the code, I'm a bit baffled by this. Still investigating..

Comment 12 Zeeshan Ali 2015-09-22 22:54:41 UTC
Created attachment 1076051 [details]
libvirt-machine-props: Refresh pool after getting it

Somehow storage pool needs to be refreshed just prior to getting info
about it even though pool is refreshed at least once before in another
part of the code. Without this small patch, we get bogus info from the
pool and I'm stumped as to why.
    
This fixes the issue of insane max storage values at customization page of wizard.

Comment 13 Zeeshan Ali 2015-09-24 12:56:25 UTC
Actually this turns out to be a libvirt issue:

virsh # vol-create gnome-boxes /tmp/volume.xml
Vol boxes-unknown-3 created from /tmp/volume.xml

virsh # pool-info gnome-boxes
Name:           gnome-boxes
UUID:           92060d87-c7c7-4b1b-9088-da996416e539
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       104.71 GiB
Allocation:     109.13 GiB
Available:      16.00 EiB

--------

Comment 14 Christophe Fergeau 2015-09-24 13:59:19 UTC
This is reproducible with master provided the (qcow2) volume <capacity> is bigger than the available space in the pool

This is caused by 
http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_driver.c;h=0494e5d7a0695612631a20ac09e92e67f0ef2c42;hb=HEAD#l1876 

1877     /* Update pool metadata ignoring the disk backend since
1878      * it updates the pool values.
1879      */
1880     if (pool->def->type != VIR_STORAGE_POOL_DISK) {
1881         pool->def->allocation += buildvoldef->target.allocation;
1882         pool->def->available -= buildvoldef->target.allocation;
1883     }

volume.xml is
<volume>
  <name>boxes-unknown-3</name>
  <capacity>21474836480</capacity> <!-- 20GB -->
  <target>
    <format type="qcow2"/>
    <permissions>
      <owner>1000</owner>
      <group>1000</group>
      <mode>744</mode>
    </permissions>
  </target>
</volume>

buildvoldef->target.allocation is 20GB, pool->def->available is < 20GB, so the substraction overflows, giving us the 16 EiB output. I guess buildvoldef->target.allocation should not be 20GB for a qcow2 volume ?

Comment 15 Ján Tomko 2015-09-24 14:31:09 UTC
Also reproducible with libvirt-1.2.8-16.el7_1.

Comment 16 Ján Tomko 2015-09-24 15:16:50 UTC
Upstream patches:
https://www.redhat.com/archives/libvir-list/2015-September/msg00906.html

Comment 17 Ján Tomko 2015-09-29 08:53:08 UTC
Fixed upstream by:
commit 56a4e9cb613aff9cd6f828c0a9283fba55ac5951
Author:     Ján Tomko <jtomko>
CommitDate: 2015-09-29 10:45:01 +0200

    Update pool allocation with new values on volume creation
    
    Since commit e0139e3, we update the pool allocation with
    the user-provided allocation values.
    
    For qcow2, the allocation is ignored for volume building,
    but we still subtracted it from pool's allocation.
    This can result in interesting values if the user-provided
    allocation is large enough:
    
    Capacity:       104.71 GiB
    Allocation:     109.13 GiB
    Available:      16.00 EiB
    
    We already do a VolRefresh on volume creation. Also refresh
    the volume after creating and use the new value to update the pool.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1163091

git describe: v1.2.20-rc1-1-g56a4e9c

Comment 20 yisun 2016-02-24 08:12:00 UTC
this was reproducible on libvirt-1.2.17-13.el7 as comment 13

Verified on libvirt libvirt-1.3.1-1.el7.x86_64 and PASSED

steps:

1. # virsh pool-info default
Name:           default
UUID:           3a9d8c79-3034-4dd0-9a6e-f4a165f3efc4
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       39.25 GiB
Allocation:     29.47 GiB
Available:      9.78 GiB


2. # cat vol.xml 
<volume>
<name>200GB_VOL</name>
<capacity>214748364800</capacity> 
<target>
<format type="qcow2"/>
<permissions>
<owner>1000</owner>
<group>1000</group>
<mode>744</mode>
</permissions>
</target>
</volume>


3. # virsh vol-create default vol.xml
Vol 200GB_VOL created from vol.xml


4. # virsh vol-info 200GB_VOL default
Name:           200GB_VOL
Type:           file
Capacity:       200.00 GiB
Allocation:     196.00 KiB


5. # virsh pool-info default
Name:           default
UUID:           3a9d8c79-3034-4dd0-9a6e-f4a165f3efc4
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       39.25 GiB
Allocation:     29.47 GiB
Available:      9.78 GiB   <==== this value is correct now.

Comment 22 errata-xmlrpc 2016-11-03 18:11:07 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/RHSA-2016-2577.html


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