Skip to content

Instantly share code, notes, and snippets.

@kiranchavala

kiranchavala/xva to ova Secret

Last active Jul 11, 2021
Embed
What would you like to do?
xva to ova
#Download the xva image file
#Convert the xva image file to raw image format
apt install xva-img
mkdir my-virtual-machine
tar -xf my-virtual-machine.xva -C my-virtual-machine
chmod -R 755 my-virtual-machine
xva-img -p disk-export my-virtual-machine/Ref\:1/ disk.raw
#Convert the raw image to vmdk
apt install qemu-utils
qemu-img convert -f raw image.raw -O vmdk image.vmdk
#Convert the vmdk to ova using Virtual box tool
VBoxManage export xcp -o xcp.ova
#Convert the ova to ovf using the ovf tool
sudo ./ovftool --lax /Users/kiran_chavala/Desktop/xcp.ova /Users/kiran_chavala/Desktop/xcp.ovf
Delete the .mf file which was created by the OVF tool.
Modifications to the xcp.ovf file
1. Change the VirtualSystemType to vmx-07.
2. Change the SATA controller to a SCSI controller.
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>ideController0</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
<Item>
<rasd:Address>1</rasd:Address>
<rasd:Caption>ideController1</rasd:Caption>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>ideController1</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:ResourceSubType>PIIX4</rasd:ResourceSubType>
<rasd:ResourceType>5</rasd:ResourceType>
</Item>
I had to change those two item with " SCSIController "
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>SCSIController</rasd:Caption>
<rasd:Description>SCSIController</rasd:Description>
<rasd:ElementName>SCSIController</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</Item>
<Item>
<rasd:Address>1</rasd:Address>
<rasd:Caption>SCSIController</rasd:Caption>
<rasd:Description>SCSIController</rasd:Description>
<rasd:ElementName>SCSIController</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</Item>
3. Remove the “Sound Card” section to avoid getting the below error message later.
Line 83: OVF hardware element ‘ResourceType’ with instance ID ‘7’: No support for the virtual hardware device type ’35’.
#upload the ovf to exi host
sudo ./ovftool --net:"NAT=VM Network" -ds=10.68.1.158 /Users/kiran_chavala/Desktop/xcp.ovf vi://root@10.68.1.158
#Launch a vm from vcenter, once the vm is up bring the interface
sudo ip link set dev ens35 up
sudo dhclient
#Download the ova
http://www.vmwarearena.com/export-vm-to-ova-or-ovf-using-ovf-tool/
ovftool vi://10.68.1.176/Bangalore\ Datacenter/vm/Discovered\ virtual\ machine/xcp /Users/kiran_chavala/Desktop/xcp.ova
Ref:
https://github.com/eriklax/xva-img
https://techpiezo.com/linux/convert-disk-images-to-various-formats-using-qemu-img/
https://nixhive.com/how-to-migrate-a-kvm-virtualbox-vm-to-vmware/
http://www.vmwarearena.com/export-vm-to-ova-or-ovf-using-ovf-tool/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment