Bug 727489

Summary: libvirtxml fails if a volume's size is greater than the size reported by qemu-img
Product: Red Hat Enterprise Linux 6 Reporter: masaya.hasegawa.hp <masaya.hasegawa>
Component: virt-v2vAssignee: Matthew Booth <mbooth>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1CC: rwu, tzheng, whuang, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-v2v-0.8.2-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 14:49:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description masaya.hasegawa.hp 2011-08-02 09:35:35 UTC
Description of problem:

Cannot convert xen local to kvm with useing virt-v2v command 
virt-v2v -i libvirtxml -op pool2  --bridge br0 skyhawk.xml
size (10485760000) < usage (10496020480) at /usr/share/perl5/vendor_perl/Sys/VirtV2V/Connection/LibVirtXMLSource.pm line 157, <$qemuimg> line 4.

Version-Release number of selected component (if applicable):

virt-v2v-0.7.1-3.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. virt-v2v -i libvirtxml -op <pool>  --bridge <bridge name> <xml file>

2.
3.
  
Actual results:
fail 

Expected results:
Convert locally vm successfully

Additional info:

# stat /temp2/xen/skyhawk
  File: `/temp2/xen/skyhawk'
  Size: 10485760000     Blocks: 20500040   IO Block: 4096   regular file
Device: 6815h/26645d    Inode: 16007172    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
...

size (10485760000) < usage (10496020480
20500040*512=10496020480

    146     if (-b $path) {
    147         $is_block = 1;
    148         $usage = $size;
    149         $is_sparse = 0;
    150     } else {
    151         $is_block = 0;
    152         my $st = stat($path);
    153         $usage = $st->blocks * 512;
    154         $is_sparse = $usage < $size ? 1 : 0;
    155     }
    156
    157     die("size ($size) < usage ($usage)") if $size < $usage;

Normally regular file size is less than disk usage if not sparse file.
So line 157 logic seems to be wrong. I think that it be removed.
In fact, after I commented out line 157, virt-v2v was success.

Comment 2 Matthew Booth 2011-08-02 10:49:07 UTC
This is fixed in upstream commit a2eacc7413a800e0e97f5f2e2bf8a43f192d69c0.

Comment 4 Huang Wenlong 2011-08-03 06:03:05 UTC
verify this bug with virt-v2v-0.8.2-1.el6

#virt-v2v -i libvirtxml -os r6 -b breth0 xen-hvm-win2003-i386.xml 

it can convert successfully  and boot

And the "die("size ($size) < usage ($usage)") if $size < $usage;"
already is removed from the source code

Comment 6 Huang Wenlong 2011-08-22 03:13:32 UTC
verify this bug in virt-v2v-0.8.3-1.el6 

# virt-v2v -i libvirtxml -os r6 -b breth0 xen-pv-rhel5.7-x86_64.xml 
xen-pv-rhel5.7-x86_64.img: 100% [====================================]D 0h02m12s
virt-v2v: xen-pv-rhel5.7-x86_64 configured with virtio drivers.

and check the source code  " die("size ($size) < usage ($usage)") if $size < $usage;" 
already removed .

Comment 7 errata-xmlrpc 2011-12-06 14:49:46 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.

http://rhn.redhat.com/errata/RHSA-2011-1615.html