I want to be able to export a KVM based VM to an ESXi 5.1/5.5 host.

My current methods ends up with the VM not being able to boot on the ESXi host. (I have tried importing the same .ova on VirtualBox 4.3 and here VirtualBox claims the size of the vmdk is 895bytes, though the acutal vmdk is close to 2GB).

These are the steps I take:

  1. Stop the KVM VM
  2. qemu-img convert -O vmdk my.qcow2 -o adapter_type=lsilogic,subformat=streamOptimized,compat6 my.vmdk
  3. Generate the my.ovf
  4. printf '\x03' | dd conv=notrunc of=my.vmdk bs=1 seek=$((0x4))
  5. tar my.ova my.ovf my.vmdk
  6. on vSphere using File -> Deploy OVF Template

The Deployment is a "success", but the machine can't boot.

I'm using:

  • F23 x86_64
  • qemu-img version 2.4.1
  • ESXi 5.1
  • vSphere 5.1

The VirtualBox I've tried is 4.3.10 on a Windows 7 Host.

Any hints would be appreciated.


It seems that step 4 is required until this patch has been applied: https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04514.html

I found step 4 from: https://bugzilla.redhat.com/show_bug.cgi?id=1299116 From this conversation it seems to me that it was addressed back in 2014? https://patchwork.ozlabs.org/patch/359685/

Excerpts from the my.ovf: Describes the set of virtual disks

<OperatingSystemSection ovf:id="101" vmw:osType="otherLinux64Guest">
  <!-- TODO make this a configurable string. -->
  <Info>RHEL 6</Info>

  <Info>1024MB, 1 CPU, 1 disk, 3 NICs - Virtual Machine.</Info>
    <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
    <!-- possible types:
           virtualbox-2.2 - VirtualBox 4.3.10.
           vmx-08 - ESXi 5.0

    <rasd:Description>SCSI Controller</rasd:Description>

    <rasd:Description>Disk Image</rasd:Description>
    <!-- The Parent is the Instance ID of the controller, here the SCSI controller. -->
    <!-- TODO should write-though be optionally be requested in vmware with vmw:Config -->

Easiest way to do it is a p2v conversion https://www.vmware.com/products/converter. After that you just need to adjust details like networking and you are done. I would go your path if I would have to convert hundreds of VM's, for anything else just use the converter.

  • This is a v2v conversion surely ? – Iain Mar 3 '16 at 8:11
  • The converter presumes that the VM is a physical one, that the only difference. Try it ;) – Alex H Mar 3 '16 at 9:22
  • I need the operation to be scriptable, since it is part of a continuous delivery pipeline. Do you know if there is a CLI for the converter? Appreciate the input. – Henk Mar 3 '16 at 9:24
  • Have not tried to command line, you can find some details here developercenter.vmware.com/web/sdk/60/vcenter-converter. Will update my answer with the link. – Alex H Mar 3 '16 at 9:31
  • @Henk Are the VMs the actual deliverables, then? – Michael Hampton Mar 3 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.