.ova import failure: Invalid value ‘0’ for attribute ‘capacity’ on element ‘Disk’

Karina
2 min readJul 3, 2020

Recently my colleague imported his VirtualBox VM to .ova format for I could use it with VMware. When I tried to import it via VMware gui I got the error:

The import failed because C:\Users\user\Documents\my_vm.ova did not pass OVF specification conformance or virtual hardware compliance checks

And after trying to ignore it:

Line 8: Invalid value ‘0’ for attribute ‘capacity’ on element ‘Disk’.

It turned out that that was a bug inside VirtualBox when importing to ova format. .ova format is simply a tar archive, so:

tar -C custom_dir/ -xvf my_vm.ova

will result in two extracted files: my_vm.vmdk and my_vm.ovf in my case. Though I saw cases with manifest file where you need to rehash .ovf file after editing it:

sha1sum myvm.ovf
vi my_vm.mf

.ovf file is a xml config which can be edited via text editor. And yes in disk section there is zero capacity which VMware doesn’t like. He wants the real value.

<DiskSection>
<Info>List of the virtual disks used in the package</Info>
<Disk ovf:capacity=”0" ovf:diskId=”vmdisk1" ovf:fileRef=”file1" ovf:format=”http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid=”7e7bfa6b-bf64–41f5–9a26–0268cf70830d”/>
</DiskSection>
<NetworkSection>

We need to get the real value from VirtualBox VM:

vboxmanage showvminfo my_vm | grep SATA

And we will see sth like this:

SATA (0, 0): /vms/user/my_vm/Snapshots/{02f4d098–02ad-4c08–9764–6f3115c5b895}.vdi (UUID: 02f4d098–02ad-4c08–9764–6f3115c5b895)

Then with this uuid:

vboxmanage showhdinfo 02f4d098–02ad-4c08–9764–6f3115c5b895
UUID: 02f4d098–02ad-4c08–9764–6f3115c5b895
Parent UUID: 66153e7c-22ad-40ea-a4e5–30a1a28081b5
State: created
Type: normal (differencing)
Auto-Reset: off
Location: /vms/shapkin/qnx7-sdp/Snapshots/{02f4d098–02ad-4c08–9764–6f3115c5b895}.vdi
Storage format: VDI
Format variant: differencing default
Capacity: 61440 MBytes
Size on disk: 1084 MBytes
Encryption: disabled
Property: AllocationBlockSize=1048576
In use by VMs: qnx7-sdp (UUID: 835506b5-dab1–453c-82af-56969ce0f42c)

we can get the real capacity of 61440 MBytes. Write it down to .ovf file:

<Disk ovf:capacity=”61440" ovf:diskId=”vmdisk1" ovf:fileRef=”file1" ovf:format=”http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid=”7e7bfa6b-bf64–41f5–9a26–0268cf70830d”/>

And while importing we will get:

Capacity mismatch for disk C:\Users\Dorozhkina\Documents\Virtual Machines\qnx700\\qnx700-disk1.vmdk.

Em…what? The reason is that we also need to set capacity allocation units, e. g. MegaBytes

<Disk ovf:capacity=”61440" ovf:capacityAllocationUnits=”MegaBytes” ovf:diskId=”vmdisk1" ovf:fileRef=”file1" ovf:format=”http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid=”7e7bfa6b-bf64–41f5–9a26–0268cf70830d”/>

Now it’s ok. What I also might to add is that you don’t need to create .ova again. Just open VM in VMware using extracted and modified .ovf and it will use .vmdk file automatically mathing the name of .ovf file.

--

--