2

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.

Thanks.

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>
</OperatingSystemSection>

<VirtualHardwareSection>
  <Info>1024MB, 1 CPU, 1 disk, 3 NICs - Virtual Machine.</Info>
  <System>
    <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
    <vssd:InstanceID>0</vssd:InstanceID>
    <vssd:VirtualSystemIdentifier>GLS</vssd:VirtualSystemIdentifier>
    <!-- possible types:
           kvm
           Linux:KVM
           virtualbox-2.2 - VirtualBox 4.3.10.
           vmx-08 - ESXi 5.0
           vmx-07
           vmx-04
      -->
    <vssd:VirtualSystemType>vmx-08</vssd:VirtualSystemType>
  </System>

  <Item>
    <rasd:Address>0</rasd:Address>
    <rasd:Caption>scsiController0</rasd:Caption>
    <rasd:Description>SCSI Controller</rasd:Description>
    <rasd:ElementName>scsiController0</rasd:ElementName>
    <rasd:InstanceID>5</rasd:InstanceID>
    <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
    <rasd:ResourceType>6</rasd:ResourceType>
  </Item>

  <Item>
    <rasd:AddressOnParent>0</rasd:AddressOnParent>
    <rasd:Caption>disk1</rasd:Caption>
    <rasd:Description>Disk Image</rasd:Description>
    <rasd:ElementName>disk1</rasd:ElementName>
    <rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
    <rasd:InstanceID>7</rasd:InstanceID>
    <!-- The Parent is the Instance ID of the controller, here the SCSI controller. -->
    <rasd:Parent>5</rasd:Parent>
    <rasd:ResourceType>17</rasd:ResourceType>
    <!-- TODO should write-though be optionally be requested in vmware with vmw:Config -->
  </Item>

1 Answer 1

2

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.

5
  • This is a v2v conversion surely ?
    – user9517
    Mar 3, 2016 at 8:11
  • The converter presumes that the VM is a physical one, that the only difference. Try it ;)
    – Alex H
    Mar 3, 2016 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, 2016 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, 2016 at 9:31
  • @Henk Are the VMs the actual deliverables, then? Mar 3, 2016 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .