Bug 709307 - Virt-v2v create preallocated file when convert a sparse ESX guest.
Summary: Virt-v2v create preallocated file when convert a sparse ESX guest.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: virt-v2v
Version: 5.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Matthew Booth
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 709648
TreeView+ depends on / blocked
 
Reported: 2011-05-31 10:35 UTC by yuping zhang
Modified: 2011-09-07 10:16 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 709648 (view as bug list)
Environment:
Last Closed: 2011-09-07 10:16:03 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description yuping zhang 2011-05-31 10:35:50 UTC
Description of problem:
Create a sparse ESX guest,then convert it to libvirt,virt-v2v create preallocated file.

Version-Release number of selected component (if applicable):
virt-v2v-0.7.1-4.el5
libguestfs-1.2.7-1.el5.13
zlib-1.2.3-3

How reproducible:
100%

Steps to Reproduce:
1.On ESX,create a sparse disk,and install os.
/vmfs/volumes/4d59e988-657f9720-6906-b8ac6f3e66d3/yp-test-rhel5-32 # ls -shl yp-test-rhel5-32-flat.vmdk
2787328 -rw-------    1 root     root         8.0G May 31 07:23 yp-test-rhel5-32-flat.vmdk

2.# virt-v2v -ic esx://10.66.72.79/?no_verify=1 -os default -b breth0  yp-test-rhel5-32
virt-v2v: Transferring storage volume yp-test-rhel5-32_yp-test-rhel5-32: 8589934592 bytes
virt-v2v: yp-test-rhel5-32 configured with virtio drivers

3.# ll -sh /var/lib/libvirt/images/yp-test-rhel5-32_yp-test-rhel5-32
8.1G -rw------- 1 root root 8.0G May 31 17:08 /var/lib/libvirt/images/yp-test-rhel5-32_yp-test-rhel5-32

Actual results:
As step 3.

Expected results:
After conversion,the disk is sparse.

Additional info:
Convert the guest with -oa sparse parameters:
# virt-v2v -ic esx://10.66.72.79/?no_verify=1 -os default -b breth0  -oa sparse yp-test-rhel5-32
After conversion the disk is sparse.

Comment 1 Qin Guan 2011-05-31 11:30:53 UTC
The default allocation is hard code as preallocated for ESX image:

1. The target volume allocation type will be created according to src sparse type in Source.pm:
# /usr/lib/perl5/vendor_perl/5.8.8/Sys/VirtV2V/Connection/Source.pm
sub copy_storage
{
...
            $dst = $target->create_volume(
                $src->get_name(),
                defined($output_format) ?  $output_format : $src->get_format(),
                $src->get_size(),
                defined($output_sparse) ? $output_sparse : $src->is_sparse()
            );

...
}

2. While the src sparse type is hard code as 0 (prealloc) for ESX image:
# /usr/lib/perl5/vendor_perl/5.8.8/Sys/VirtV2V/Connection/LibVirtSource.pm
sub get_volume
{
...
   if ($uri->scheme eq "esx") {
        $format = "raw";

        $transfer = $self->_get_transfer($path, 0, $format, 0);

        $name = $transfer->esx_get_name();
        $size = $transfer->esx_get_size();
        $usage = $size;
        $is_sparse = 0;    <--- hard code as prealloc
        $is_block = 0;
    }
...
}

Comment 3 RHEL Program Management 2011-09-07 10:16:03 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.


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