Bug 698658 - vol-wipe will not work well when allocation all the capacity for raw type volume
Summary: vol-wipe will not work well when allocation all the capacity for raw type volume
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-21 13:37 UTC by weizhang
Modified: 2015-11-17 06:08 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-21 15:30:35 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description weizhang 2011-04-21 13:37:19 UTC
Description of problem:
I create a volume with xml
<volume>
  <name>vol-raw</name>
  <capacity unit="G">1</capacity>
<allocation unit='G'>1</allocation>
  <target>
    <path>/var/lib/libvirt/images/vol-raw</path>
    <format type="raw"/>
  </target>
</volume>
on dir/fs pool and get the vol-info
# virsh vol-info --pool dir_pool vol-raw
Name:           vol-raw
Type:           file
Capacity:       1.00 GB
Allocation:     1.00 GB

after I wipe the volume and see the vol-info, the allocation still 1G. If I allocation with 1023M, then after volume wiping, the allocation will change to 0.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.159.el6.x86_64
libvirt-0.8.7-18.el6.x86_64
kernel-2.6.32-130.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1. define and start a dir/fs pool with
<pool type='dir'>
  <name>dir_pool</name>
  <uuid>70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2</uuid>
  <capacity>0</capacity>
  <allocation>0</allocation>
  <available>0</available>
  <source>
  </source>
  <target>
    <path>/var/lib/libvirt/images</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
      <label>some_label_t</label>
    </permissions>
  </target>
</pool>
# virsh pool-define /tmp/dir_pool.xml
# virsh pool-start dir_pool      
2. create raw type volume with xml
<volume>
  <name>vol-raw</name>
  <capacity unit="G">1</capacity>
<allocation unit='G'>1</allocation>
  <target>
    <path>/var/lib/libvirt/images/vol-raw</path>
    <format type="raw"/>
  </target>
</volume>
# virsh vol-info --pool dir_pool vol-raw
Name:           vol-raw
Type:           file
Capacity:       1.00 GB
Allocation:     1.00 GB

3. wipe volume 
# virsh vol-wipe --pool dir_pool vol-raw

4. see vol-info
#  virsh vol-info --pool dir_pool vol-raw
Name:           vol-raw
Type:           file
Capacity:       1.00 GB
Allocation:     1.00 GB
 
Actual results:
allocation still 1G

Expected results:
allocation should be 0G

Additional info:

Comment 1 Daniel Berrangé 2011-04-21 15:30:35 UTC
> Actual results:
> allocation still 1G
>
> Expected results:
> allocation should be 0G

This is a mis-understanding of what wipe will do.

The 'wipe' operation is defined to clear all data in the file, such that future reads return all zeros. The effect of 'wipe' on the allocation is left undefined, though the ideal goal is to preserve the existing allocation as closely as possible.

Currently if the file is fully allocated, it will remain fully allocated. If it is at all sparse, it will be made completely sparse.


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