Bug 1152998

Summary: virt-v2v / qemu-img fails on ova image
Product: Red Hat Enterprise Linux 7 Reporter: Marko Myllynen <myllynen>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: codong, dyuan, juzhou, mbooth, myllynen, mzhan, ptoscano, rjones, shavivi, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:46:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marko Myllynen 2014-10-15 10:51:54 UTC
Description of problem:
Testing virt-v2v-1.27.62-1.1.el7.x86_64 preview, I get this on an OVA image:

[root@localhost tmp]# mkdir -p out
[root@localhost tmp]# virt-v2v -v -x -i ova test.ova -o local -os out
[   0.0] Opening the source -i ova test.ova
    source name: TEST-1
hypervisor type: vmware
         memory: 2147483648 (bytes)
       nr vCPUs: 1
   CPU features:
        display:
disks:
        /var/tmp/ova.Om008b/TEST-1.0.1.439-disk1.vmdk.gz (vmdk) [hd0]
removable media:
        CD-ROM [hd0]
NICs:
        Network "Network adapter 1"
[  20.0] Creating an overlay to protect the source from being modified
qemu-img create -q -f qcow2 -b '/var/tmp/ova.Om008b/TEST-1.0.1.439-disk1.vmdk.gz' -o 'compat=1.1,backing_fmt=vmdk' /var/tmp/v2vovl5c916c.qcow2
qemu-img: /var/tmp/v2vovl5c916c.qcow2: Could not open '/var/tmp/ova.Om008b/TEST-1.0.1.439-disk1.vmdk.gz': Could not open '/var/tmp/ova.Om008b/TEST-1.0.1.439-disk1.vmdk.gz': Wrong medium type: Wrong medium type
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:

  virt-v2v -v -x [...]
[root@localhost tmp]# qemu-img info test.ova
image: test.ova
file format: raw
virtual size: 22G (23118020096 bytes)
disk size: 22G
[root@localhost tmp]#

Comment 1 Richard W.M. Jones 2014-10-15 10:56:34 UTC
Shahar,

There are several OVA variants which we don't seem to be able to
cope with at the moment:

 - ZIP as a container (instead of tar)

 - gzipped files inside the container, as in this bug

Comment 2 Richard W.M. Jones 2014-10-15 10:57:05 UTC
So the rest of my comment above was ...

Is there any documentation/specification of the OVA format?

Comment 4 Richard W.M. Jones 2014-10-15 13:25:43 UTC
Example of ZIP as a container:

http://www.pqr.com/ubuntu-jeos

Comment 5 Richard W.M. Jones 2014-10-15 13:26:13 UTC
Example of someone talking about the *.vmdk.gz OVA which is
the subject of this bug:

http://sharingtechknowledge.blogspot.de/2012/02/virtualbox-could-not-find-valid-medium.html

Comment 6 Richard W.M. Jones 2014-10-15 13:27:24 UTC
More info about *.vmdk.gz:

http://kb.juniper.net/InfoCenter/index?page=content&id=KB26449

Comment 7 Richard W.M. Jones 2014-10-18 21:05:52 UTC
Patches posted:
https://www.redhat.com/archives/libguestfs/2014-October/thread.html#00140

Comment 8 tingting zheng 2014-10-20 03:17:07 UTC
I've tested -i ova option with the below version,it works.
virt-v2v-1.27.63-1.1.el7.x86_64 

# virt-v2v -i ova -os default esx-rhel6.ova -of raw
[   0.0] Opening the source -i ova esx-rhel6.ova
tar: esx-rhel6.ovf: time stamp 2014-10-15 21:50:42 is 63610.941664554 s in the future
tar: esx-rhel6-disk1.vmdk: time stamp 2014-10-15 21:50:42 is 63576.665857463 s in the future
tar: esx-rhel6.mf: time stamp 2014-10-15 21:50:42 is 63576.641153832 s in the future
[  34.0] Creating an overlay to protect the source from being modified
[  35.0] Opening the overlay
[  45.0] Initializing the target -o libvirt -os default
[  45.0] Inspecting the overlay
[  59.0] Checking for sufficient free disk space in the guest
[  59.0] Estimating space required on target for each disk
[  59.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown 
device "sda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device 
"sda".  You may have to fix this entry manually after conversion.
This guest has virtio drivers installed.
[ 130.0] Mapping filesystem data to avoid copying unused and blank areas
[ 130.0] Closing the overlay
[ 131.0] Copying disk 1/1 to /var/lib/libvirt/images/esx-rhel6-sda (raw)
    (100.00/100%)
[ 209.0] Creating output metadata
Pool default refreshed

Domain esx-rhel6 defined from /tmp/v2vlibvirt2bbcdd.xml

[ 211.0] Finishing off

Comment 9 Marko Myllynen 2014-10-20 06:51:57 UTC
I'm still getting an error:

[root@localhost tmp]# virt-v2v -v -x -i ova test.ova -o local -os out
virt-v2v: libguestfs 1.28.1 (x86_64)
[   0.0] Opening the source -i ova test.ova
tar -xf 'test.ova' -C '/var/tmp/ova.kxWxyN'
    source name: TEST
hypervisor type: vmware
         memory: 2147483648 (bytes)
       nr vCPUs: 1
   CPU features:
        display:
disks:
        /var/tmp/ova.kxWxyN/test-disk1.vmdk.gz (vmdk) [hda]
removable media:
        CD-ROM [hda]
NICs:
        Network "Network adapter 1"
[ 177.0] Creating an overlay to protect the source from being modified
qemu-img create -q -f qcow2 -b '/var/tmp/ova.kxWxyN/test-disk1.vmdk.gz' -o 'compat=1.1,backing_fmt=vmdk' /var/tmp/v2vovl0a4bf3.qcow2
qemu-img: /var/tmp/v2vovl0a4bf3.qcow2: Could not open '/var/tmp/ova.kxWxyN/test-disk1.vmdk.gz': invalid VMDK image descriptor: Invalid argument
virt-v2v: error: qemu-img command failed, see earlier errors

Comment 10 Shahar Havivi 2014-10-20 07:29:07 UTC
I don't think that Richards patches are merged (did you test from source and apply the patches)?

Comment 11 Marko Myllynen 2014-10-20 07:36:22 UTC
(In reply to Shahar Havivi from comment #10)
> I don't think that Richards patches are merged (did you test from source and
> apply the patches)?

Good point.. I installed latest updates from Richard's repo and it was newer than the version mentioned in comment 8 so I thought it'd be ready for testing.

Thanks, I'll retest with a build with the patches in a bit later.

Comment 12 Richard W.M. Jones 2014-10-20 07:43:44 UTC
Yes I think that OVA was just an ordinary tar file.  You can try doing:

  tar tf esx-rhel6.ova

For an example of the ZIP format OVA, you can either download one
(eg: http://www.pqr.com/ubuntu-jeos) or even easier just take the
tar file, unpack it, and compress the directory using 'zip'.

Also the patched virt-v2v will support supplying an unpacked
directory name.

And an OVA (tar or zip) that contains *.vmdk.gz files (for this
you will need to edit the *.ovf <References>).

Comment 13 Richard W.M. Jones 2014-10-20 07:55:18 UTC
The patches are not upstream, so unless you applied them
yourself on top of git, *.vmdk.gz wouldn't work.

Comment 16 Marko Myllynen 2014-10-21 12:51:07 UTC
> Fixed In Version: libguestfs-1.28.1-1.2.el7

Thanks, the OVA image is now properly processed with this version.

Comment 17 tingting zheng 2014-10-22 06:08:54 UTC
I tested with:
virt-v2v-1.28.1-1.2.el7.x86_64
libguestfs-1.28.1-1.2.el7.x86_64

1.Test ZIP format OVA:success.
# tar xf esx-rhel6.ova
# ls
esx-rhel6-disk1.vmdk  esx-rhel6.mf  esx-rhel6.ovf

# zip esx-rhel6-ova.zip esx-rhel6-disk1.vmdk esx-rhel6.mf esx-rhel6.ovf
  adding: esx-rhel6-disk1.vmdk (deflated 3%)
  adding: esx-rhel6.mf (deflated 15%)
  adding: esx-rhel6.ovf (deflated 80%)

# virt-v2v -i ova -os default esx-rhel6-ova.zip -of raw
[   0.0] Opening the source -i ova esx-rhel6-ova.zip
[  41.0] Creating an overlay to protect the source from being modified
[  43.0] Opening the overlay
[ 255.0] Initializing the target -o libvirt -os default
[ 255.0] Inspecting the overlay
[ 269.0] Checking for sufficient free disk space in the guest
[ 269.0] Estimating space required on target for each disk
[ 269.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown 
device "sda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device 
"sda".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 348.0] Mapping filesystem data to avoid copying unused and blank areas
[ 348.0] Closing the overlay
[ 349.0] Copying disk 1/1 to /var/lib/libvirt/images/esx-rhel6-sda (raw)
    (100.00/100%)
[ 442.0] Creating output metadata
Pool default refreshed

Domain esx-rhel6 defined from /tmp/v2vlibvirt59e863.xml

[ 444.0] Finishing off


2.Test unpacked ova directory name.
2.1 Test -i ova with relative path:fail,refer to bug 1155121.
# virt-v2v -i ova -os default esx-rhel6 -of raw
[   0.0] Opening the source -i ova esx-rhel6
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
virt-v2v: error: libguestfs error: guestfs_launch failed.
This usually means the libguestfs appliance failed to start or crashed.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
or run 'libguestfs-test-tool' and post the *complete* output into a
bug report or message to the libguestfs mailing list.

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

2.2 Test -i ova with absolute path:success.
# virt-v2v -i ova -os default /var/lib/libvirt/images/esx-rhel6 -of raw 
[   0.0] Opening the source -i ova /var/lib/libvirt/images/esx-rhel6
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[   9.0] Initializing the target -o libvirt -os default
[  10.0] Inspecting the overlay
[  25.0] Checking for sufficient free disk space in the guest
[  25.0] Estimating space required on target for each disk
[  25.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown 
device "sda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device 
"sda".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 101.0] Mapping filesystem data to avoid copying unused and blank areas
[ 101.0] Closing the overlay
[ 102.0] Copying disk 1/1 to /var/lib/libvirt/images/esx-rhel6-sda (raw)
    (100.00/100%)
[ 192.0] Creating output metadata
Pool default refreshed
……

3.Test OVA (tar or zip) that contains *.vmdk.gz files

# zip esx-rhel6-disk1.vmdk.gz esx-rhel6-disk1.vmdk 
  adding: esx-rhel6-disk1.vmdk (deflated 3%)

# ls -l
total 1166364
-rw-r--r--. 1 root root 1194343979 Oct 21 23:28 esx-rhel6-disk1.vmdk.gz
-rw-r--r--. 1 root root       9058 Oct 21 23:35 esx-rhel6.ovf

Modify esx-rhel6.ovf as below:
  <References>
    <File ovf:href="esx-rhel6-disk1.vmdk" ovf:id="file1" ovf:size="1225335808" />
  </References>

to:
  <References>
    <File ovf:compression="gzip" ovf:href="esx-rhel6-disk1.vmdk.gz" ovf:id="file1" ovf:size="1194343979" />
  </References>

3.1 Test ova with zip format that contains *.vmdk.gz files:fail
# zip esx-rhel6-vmdkgz.zip esx-rhel6-disk1.vmdk.gz esx-rhel6.ovf
  adding: esx-rhel6-disk1.vmdk.gz (deflated 0%)
  adding: esx-rhel6.ovf (deflated 80%)

# virt-v2v -i ova -os default esx-rhel6-vmdkgz.zip -v -x
virt-v2v: libguestfs 1.28.1 (x86_64)
[   0.0] Opening the source -i ova esx-rhel6-vmdkgz.zip
unzip -j -d '/var/tmp/ova.vdCZcW' 'esx-rhel6-vmdkgz.zip'
Archive:  esx-rhel6-vmdkgz.zip
  inflating: /var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz  
  inflating: /var/tmp/ova.vdCZcW/esx-rhel6.ovf  
    source name: esx-rhel6
hypervisor type: vmware
         memory: 2147483648 (bytes)
       nr vCPUs: 1
   CPU features: 
        display: 
disks:
	/var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz (vmdk) [hda]
removable media:
	CD-ROM [hda]
	Floppy [hda]
NICs:
	Network "Ethernet 1"
[  43.0] Creating an overlay to protect the source from being modified
qemu-img create -q -f qcow2 -b '/var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz' -o 'compat=1.1,backing_fmt=vmdk' /var/tmp/v2vovlc12bbc.qcow2
qemu-img: /var/tmp/v2vovlc12bbc.qcow2: Could not open '/var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz': invalid VMDK image descriptor: Invalid argument
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


3.2 Test ova with tar format that contains *.vmdk.gz files:fail
# tar cf esx-rhel6-vmdkgz.tar esx-rhel6-disk1.vmdk.gz  esx-rhel6.ovf
# virt-v2v -i ova -os default esx-rhel6-vmdkgz.tar -v -x
virt-v2v: libguestfs 1.28.1 (x86_64)
[   0.0] Opening the source -i ova esx-rhel6-vmdkgz.tar
tar -xf 'esx-rhel6-vmdkgz.tar' -C '/var/tmp/ova.KvPQoU'
    source name: esx-rhel6
hypervisor type: vmware
         memory: 2147483648 (bytes)
       nr vCPUs: 1
   CPU features: 
        display: 
disks:
	/var/tmp/ova.KvPQoU/esx-rhel6-disk1.vmdk.gz (vmdk) [hda]
removable media:
	CD-ROM [hda]
	Floppy [hda]
NICs:
	Network "Ethernet 1"
[  43.0] Creating an overlay to protect the source from being modified
qemu-img create -q -f qcow2 -b '/var/tmp/ova.KvPQoU/esx-rhel6-disk1.vmdk.gz' -o 'compat=1.1,backing_fmt=vmdk' /var/tmp/v2vovle12420.qcow2
qemu-img: /var/tmp/v2vovle12420.qcow2: Could not open '/var/tmp/ova.KvPQoU/esx-rhel6-disk1.vmdk.gz': invalid VMDK image descriptor: Invalid argument
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


Not sure whether my steps are right,I removed esx-rhel6.mf file as I saw from comment 6:"One option is to simply delete the file from the directory that contains the .ovf which will allow upload without integrity checking."

Marko,would u pls help to test your enviroment?thanks.

Comment 18 Marko Myllynen 2014-10-22 06:56:51 UTC
(In reply to tingting zheng from comment #17)
> 
> Not sure whether my steps are right,I removed esx-rhel6.mf file as I saw
> from comment 6:"One option is to simply delete the file from the directory
> that contains the .ovf which will allow upload without integrity checking."
> 
> Marko,would u pls help to test your enviroment?thanks.

The OVA image I had was created with VMware, I don't know the exact steps as another team at the customer provided it to me. But I was using the latest versions from Richard's preview repo yesterday and I didn't see any warning/errors like the ones above.

Thanks.

Comment 19 tingting zheng 2014-10-22 07:04:25 UTC
(In reply to Marko Myllynen from comment #18)
> (In reply to tingting zheng from comment #17)
> > 
> > Not sure whether my steps are right,I removed esx-rhel6.mf file as I saw
> > from comment 6:"One option is to simply delete the file from the directory
> > that contains the .ovf which will allow upload without integrity checking."
> > 
> > Marko,would u pls help to test your enviroment?thanks.
> 
> The OVA image I had was created with VMware, I don't know the exact steps as
> another team at the customer provided it to me. But I was using the latest
> versions from Richard's preview repo yesterday and I didn't see any
> warning/errors like the ones above.
> 
> Thanks.

Thanks for your info.
Hi,Richard
   Would you pls help to check the result of step 3.1 and 3.1 in comment 17?

Comment 20 Richard W.M. Jones 2014-10-22 09:27:35 UTC
> 3.1 Test ova with zip format that contains *.vmdk.gz files:fail
> # zip esx-rhel6-vmdkgz.zip esx-rhel6-disk1.vmdk.gz esx-rhel6.ovf
>   adding: esx-rhel6-disk1.vmdk.gz (deflated 0%)
>   adding: esx-rhel6.ovf (deflated 80%)
>
> # virt-v2v -i ova -os default esx-rhel6-vmdkgz.zip -v -x
> virt-v2v: libguestfs 1.28.1 (x86_64)
> [   0.0] Opening the source -i ova esx-rhel6-vmdkgz.zip
> unzip -j -d '/var/tmp/ova.vdCZcW' 'esx-rhel6-vmdkgz.zip'
> Archive:  esx-rhel6-vmdkgz.zip
>   inflating: /var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz  
>   inflating: /var/tmp/ova.vdCZcW/esx-rhel6.ovf  
[...]
> disks:
> 	/var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz (vmdk) [hda]

I think this is a bug, since the new code is supposed to
be able to handle *.gz inside tar/zip file.

However I cannot reproduce it myself ...

$ ls ubb
ub1404lts-disk1.vmdk.gz  ub1404lts.mf  ub1404lts.ovf
$ grep File ubb/ub1404lts.ovf 
    <File ovf:href="ub1404lts-disk1.vmdk.gz" ovf:id="file1" ovf:size="88965632"/>
$ zip -r test.zip ubb
updating: ubb/ (stored 0%)
  adding: ubb/ub1404lts.ovf (deflated 76%)
  adding: ubb/ub1404lts-disk1.vmdk.gz (deflated 0%)
  adding: ubb/ub1404lts.mf (deflated 15%)
$ virt-v2v --print-source -i ova test.zip 
[   0.0] Opening the source -i ova test.zip
Source guest information (--print-source option):

    source name: ub1404lts
[...]
disks:
	/var/tmp/ova.ynhx2M/ajvblsdw.vmdk (vmdk) [hda]

I have a theory about what might be going wrong in the zip case: If you
use the 'zip' command, it adds files to the existing zip (it doesn't create
a new zip from scratch).  Perhaps your zip file contains multiple copies
of files?  Try running 'unzip -v esx-rhel6-vmdkgz.zip' and check it only
contains the files that you think it contains.

Comment 21 tingting zheng 2014-10-22 10:21:46 UTC
(In reply to Richard W.M. Jones from comment #20)
> > 3.1 Test ova with zip format that contains *.vmdk.gz files:fail
> > # zip esx-rhel6-vmdkgz.zip esx-rhel6-disk1.vmdk.gz esx-rhel6.ovf
> >   adding: esx-rhel6-disk1.vmdk.gz (deflated 0%)
> >   adding: esx-rhel6.ovf (deflated 80%)
> >
> > # virt-v2v -i ova -os default esx-rhel6-vmdkgz.zip -v -x
> > virt-v2v: libguestfs 1.28.1 (x86_64)
> > [   0.0] Opening the source -i ova esx-rhel6-vmdkgz.zip
> > unzip -j -d '/var/tmp/ova.vdCZcW' 'esx-rhel6-vmdkgz.zip'
> > Archive:  esx-rhel6-vmdkgz.zip
> >   inflating: /var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz  
> >   inflating: /var/tmp/ova.vdCZcW/esx-rhel6.ovf  
> [...]
> > disks:
> > 	/var/tmp/ova.vdCZcW/esx-rhel6-disk1.vmdk.gz (vmdk) [hda]
> 
> I think this is a bug, since the new code is supposed to
> be able to handle *.gz inside tar/zip file.
> 
> However I cannot reproduce it myself ...
> 
> $ ls ubb
> ub1404lts-disk1.vmdk.gz  ub1404lts.mf  ub1404lts.ovf
> $ grep File ubb/ub1404lts.ovf 
>     <File ovf:href="ub1404lts-disk1.vmdk.gz" ovf:id="file1"
> ovf:size="88965632"/>
> $ zip -r test.zip ubb
> updating: ubb/ (stored 0%)
>   adding: ubb/ub1404lts.ovf (deflated 76%)
>   adding: ubb/ub1404lts-disk1.vmdk.gz (deflated 0%)
>   adding: ubb/ub1404lts.mf (deflated 15%)
> $ virt-v2v --print-source -i ova test.zip 
> [   0.0] Opening the source -i ova test.zip
> Source guest information (--print-source option):
> 
>     source name: ub1404lts
> [...]
> disks:
> 	/var/tmp/ova.ynhx2M/ajvblsdw.vmdk (vmdk) [hda]
> 
> I have a theory about what might be going wrong in the zip case: If you
> use the 'zip' command, it adds files to the existing zip (it doesn't create
> a new zip from scratch).  Perhaps your zip file contains multiple copies
> of files?  Try running 'unzip -v esx-rhel6-vmdkgz.zip' and check it only
> contains the files that you think it contains.

# tar tf esx-rhel6-vmdkgz.tar
esx-rhel6-disk1.vmdk.gz
esx-rhel6.ovf

# unzip esx-rhel6-vmdkgz.zip
Archive:  esx-rhel6-vmdkgz.zip
  inflating: esx-rhel6-disk1.vmdk.gz  
  inflating: esx-rhel6.ovf

Comment 22 Richard W.M. Jones 2014-10-22 12:36:49 UTC
Right, I understand.  It's because your .gz file isn't gzip!

> # zip esx-rhel6-disk1.vmdk.gz esx-rhel6-disk1.vmdk 
>   adding: esx-rhel6-disk1.vmdk (deflated 3%)

We don't support zipped vmdk, only gzipped :-)  Try this instead:

rm esx-rhel6-disk1.vmdk.gz
gzip esx-rhel6-disk1.vmdk    # creates esx-rhel6-disk1.vmdk.gz
rm esx-rhel6-vmdkgz.zip
zip esx-rhel6-vmdkgz.zip esx-rhel6-disk1.vmdk.gz esx-rhel6.ovf
virt-v2v -i ova esx-rhel6-vmdkgz.zip -o null

Comment 23 tingting zheng 2014-10-23 06:40:46 UTC
(In reply to Richard W.M. Jones from comment #22)
> Right, I understand.  It's because your .gz file isn't gzip!
> 
> > # zip esx-rhel6-disk1.vmdk.gz esx-rhel6-disk1.vmdk 
> >   adding: esx-rhel6-disk1.vmdk (deflated 3%)
> 
> We don't support zipped vmdk, only gzipped :-)  Try this instead:
> 
> rm esx-rhel6-disk1.vmdk.gz
> gzip esx-rhel6-disk1.vmdk    # creates esx-rhel6-disk1.vmdk.gz
> rm esx-rhel6-vmdkgz.zip
> zip esx-rhel6-vmdkgz.zip esx-rhel6-disk1.vmdk.gz esx-rhel6.ovf
> virt-v2v -i ova esx-rhel6-vmdkgz.zip -o null

Yes,I made it as zipped vmdk,after tried the above steps to create gzipped vmdk files,I can use virt-v2v to convert them successfully.

#  virt-v2v -i ova -os default esx-rhel6-vmdkgz.tar -of raw
[   0.0] Opening the source -i ova esx-rhel6-vmdkgz.tar
[ 165.0] Creating an overlay to protect the source from being modified
[ 166.0] Opening the overlay
[ 180.0] Initializing the target -o libvirt -os default
[ 180.0] Inspecting the overlay
[ 200.0] Checking for sufficient free disk space in the guest
[ 200.0] Estimating space required on target for each disk
[ 200.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown 
device "sda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device 
"sda".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 289.0] Mapping filesystem data to avoid copying unused and blank areas
[ 294.0] Closing the overlay
[ 298.0] Copying disk 1/1 to /var/lib/libvirt/images/esx-rhel6-sda (raw)
    (100.00/100%)
[ 473.0] Creating output metadata
Pool default refreshed

Domain esx-rhel6 defined from /tmp/v2vlibvirtb30fcc.xml

[ 476.0] Finishing off


# virt-v2v -i ova -o null esx-rhel6-vmdkgz.zip -of raw 
[   0.0] Opening the source -i ova esx-rhel6-vmdkgz.zip
[ 141.0] Creating an overlay to protect the source from being modified
[ 143.0] Opening the overlay
[ 158.0] Initializing the target -o null
[ 158.0] Inspecting the overlay
[ 182.0] Checking for sufficient free disk space in the guest
[ 182.0] Estimating space required on target for each disk
[ 182.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown 
device "sda".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device 
"sda".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 281.0] Mapping filesystem data to avoid copying unused and blank areas
[ 282.0] Closing the overlay
[ 283.0] Copying disk 1/1 to /var/tmp/null.pDDWyI/sda (raw)
    (100.00/100%)
[ 435.0] Creating output metadata
[ 435.0] Finishing off

Refer to the above comments and step 1 and step 2 in comment 17,move the bug to VERIFIED.

Comment 25 errata-xmlrpc 2015-03-05 13:46:20 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-0303.html