Description of problem: When an OVF file (for example) contains these lines: <Item> <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits> <rasd:Caption>512 MB of memory</rasd:Caption> <rasd:Description>Memory Size</rasd:Description> <rasd:ElementName>512 MB of memory</rasd:ElementName> <rasd:InstanceID>2</rasd:InstanceID> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>512</rasd:VirtualQuantity> </Item> virt-v2v craps up with: Unexpected memory units: MegaBytes at /usr/share/perl5/vendor_perl/Sys/VirtConvert/Connection/VMwareOVASource.pm line 133. Version-Release number of selected component (if applicable): Fedora 20 w/virt-v2v 0.9.0 How reproducible: Import an (OVA with an) OVF file with anything other than 'byte' as memory allocation units. Additional info: The DMTF OVF standard (http://www.dmtf.org/standards/ovf) states under 8.1 that "this virtual hardware description is based on the CIM classes CIM_VirtualSystemSettingData and CIM_ResourceAllocationSettingData" CIM_ResourceAllocationSettingData (http://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_ResourceAllocationSettingData.html) states for AllocationUnits that "The value of this property shall be a legal value of the Programmatic Units qualifier as defined in Annex C.1 of DSP0004". DSP0004 (http://www.dmtf.org/sites/default/files/standards/documents/DSP0004V2.3_final.pdf) specifies for related sizes "Bytes, KiloBytes, MegaBytes, GigaBytes" as valid UNITS. The code in VMwareOVASource.pm (the name of which in and of itself is a bit odd, considering OVA/OVF is an open standard) reads: if (defined($memory)) { my $units = _node_val($memory, 'rasd:AllocationUnits/text()'); $units =~ /^byte \* 2\^(\d+)$/ or die "Unexpected memory units: $units"; $units = 2 ** $1; $memory = _node_val($memory, 'rasd:VirtualQuantity/text()') * $units; } else { $memory = 1 * 1024 * 1024 * 1024; # Shouldn't happen, but default to 1GB RAM } The ^byte is strictly speaking wrong because of capitalization, but regardless, anything not in bytes is considered 'Unexpected'.
hmmm... Strangely enough the examples in the comments behind AllocationUnits do specify 'bytes*10^3' as specific possibility :) However, so would 'bytes' be, which is something the code doesn't take into account either, nor decimal counts.
Created attachment 853338 [details] Proposed patch; fully compliant with OVF specs AFAICT Patch changes the Memory parser to include the full OVF spec. Old parser just supported 'byte * 2^[number]', new parser accepts for example: 'byte' 'MegaBytes' 'KiloBytes * 2^5' 'byte*10^3' Furthermore, according to spec, VirtualQuantityUnits should be used to find the unit for VirtualQuantity, but neither VMware nor VirtualBox seem to do this, instead insisting on AllocationUnits. After patch checks VirtualQuantityUnits first, and if it's not there, fall back to AllocationUnits.
Created attachment 853938 [details] Revised patch; split out byte-calculation into function Revised patch, the Units property interpretation into bytes is now in a separate function so it can be reused for https://bugzilla.redhat.com/show_bug.cgi?id=1056640
Hi, thanks for the bug report. Unfortunately it is filed against a very old version of virt-v2v (0.9) which we don't support at all. Luckily there is a newer version which almost certainly fixes your bug already. It's available starting in Fedora 21. If you still experience this bug, please try with the new version, and reopen if it still happens.
(In reply to Richard W.M. Jones from comment #1) > Unfortunately it is filed against a > very old version of virt-v2v (0.9) Well, that tends to happen if you wait 16 months with a reply to a ready2commit submitted patch.