Hide Forgot
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.
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; } ... }
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.