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 1241454 - Underlying file was not removed when volume create/build fails
Summary: Underlying file was not removed when volume create/build fails
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: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-09 09:20 UTC by Yang Yang
Modified: 2015-11-19 06:48 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.17-2.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:48:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1223177 0 medium CLOSED Metadata preallocation should not be supported for rbd based volumes 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Internal Links: 1223177

Description Yang Yang 2015-07-09 09:20:25 UTC
Description of problem:
commit 4749d82a8bb92b908fe7f30038d8b1ea3390384d introduces a regression. When I tried to create a huge volume, the volume created failed as expect, but the underlying file was not removed. I think we should delete underlying file when buildret failed.

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

How reproducible:
100%

Steps to Reproduce:
1. Make sure haha.img does not exist
# virsh vol-list default| grep haha.img
# ll /var/lib/libvirt/images/haha.img
ls: cannot access /var/lib/libvirt/images/haha.img: No such file or directory

2. create haha.img in default pool with huge size
# virsh vol-create-as default haha.img 100000G
error: Failed to create vol haha.img
error: cannot allocate 107374182400000 bytes in file '/var/lib/libvirt/images/haha.img': No space left on device

3. check if haha.img file exists
# virsh vol-list default| grep haha.img
# ll /var/lib/libvirt/images/haha.img
-rw-------. 1 root root 107374182400000 Jul  6 16:35 /var/lib/libvirt/images/haha.img

Actual results:


Expected results:
Underlying file should be removed when volume create/build fails

Additional info:

Comment 2 Erik Skultety 2015-07-09 12:48:56 UTC
Fixed upstream:

commit b5637871920c88d88a32343a13c6c1476062a6bb
Author: Erik Skultety <eskultet>
Date:   Thu Jul 9 11:17:12 2015 +0200

    storage: Revert volume obj list updating after volume creation (4749d82a)
    
    This patch reverts commit 4749d82a which tried to tweak the logic in
    volume creation. We did realloc and update our object list before we executed
    volume building within a specific storage backend. If that failed, we
    had to update (again) our object list to the original state as it was before the
    build and delete the volume from the pool (even though it didn't exist - this
    truly depends on the backend).
    I misunderstood the base idea to be able to poll the status of the volume
    creation using vol-info. After commit 4749d82a this wasn't possible
    anymore, although no BZ has been reported yet.
    
    Commit 4749d82a also claimed to fix
    https://bugzilla.redhat.com/show_bug.cgi?id=1223177, but commit c8be606b of the
    same series as 4749d82ad (which was more of a refactor than a fix)
    fixes the same issue so the revert should be pretty straightforward.
    Further more, BZ https://bugzilla.redhat.com/show_bug.cgi?id=1241454 can be
    fixed with this revert.

v1.2.17-58-gb563787

Comment 6 yisun 2015-07-14 05:48:27 UTC
Verified on:
libvirt-1.2.17-2.el7.x86_64
qemu-kvm-rhev-2.3.0-9.el7.x86_64
kernel-3.10.0-290.el7.x86_64


1. Prepared a pool
# virsh pool-dumpxml default
<pool type='dir'>
  <name>default</name>
  <uuid>3fb748f5-8b63-4aad-bd76-908b5434e4af</uuid>
  <capacity unit='bytes'>214643507200</capacity>
  <allocation unit='bytes'>30016999424</allocation>
  <available unit='bytes'>184626507776</available>
  <source>
  </source>
  <target>
    <path>/home/pool</path>
    <permissions>
      <mode>0755</mode>
      <owner>0</owner>
      <group>0</group>
      <label>unconfined_u:object_r:home_root_t:s0</label>
    </permissions>
  </target>
</pool>

2. create a volume with size exceeding disk left space
# virsh vol-create-as default big.img  10000G
error: Failed to create vol big.img
error: cannot allocate 10737418240000 bytes in file '/home/pool/big.img': No space left on device

3. check the pool's directory
# ll /home/pool/ -a
total 4
drwxr-xr-x. 2 root root    6 Jul 14 13:31 .
drwxr-xr-x. 6 root root 4096 Jul 13 18:14 ..
<==== vol file not created as expect.

[root@localhost ~]# virsh vol-list default
 Name                 Path                                   
------------------------------------------------------------------------------
<===== no vol listed as expect.

4. create a volume with reasonable size
# virsh vol-create-as default big.img  1G
Vol big.img created

5. check the vol-info works well against the volume
# virsh vol-info big.img --pool default
Name:           big.img
Type:           file
Capacity:       1.00 GiB
Allocation:     1.00 GiB

Comment 8 errata-xmlrpc 2015-11-19 06:48:35 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.