Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ova: improve handling of extra devices
When encountering an ova file, we iterate throught the devices listed in the <VirtualHardwareSection> of the file and attempt to identify items that are useful to us (notably Network Adapters, memory definition, etc). The remaining items are stored as a list of generic devices with a `Kind` that is a free-form string. It appears that we tried to make the generic devices slightly nicer by stripping off number suffixes from the names of the devices and setting the device `Kind` to e.g. "SCSI Controller" rather than "SCSI Controller 1". But the code assumes that *all* `Items` in this file have the same numeric suffix format for `ElementName`. In reality, the `Items` vary quite a bit. This variation occurs both between different `Items` within the same file, and especially between ova files that are generated by different sources. For example, in an ova file that was generated with vsphere 7.0, the `ElementName` for my video device is simply "Video Card" with no suffix, whereas the Hard Disk has an `ElementName` of "Hard Disk 1". So the ova provider transforms the video card into a generic device with Kind set to the truncated string "Video Ca". In addition, I encountered ova files that were produced by VirtualBox where many of the `Items` in this list did not even contain `ElementName` elements, but did have `Description`s. So to make the ova provider more robust to files that don't follow our current assumptions: - only trim the suffix if the `ElementName` string ends with a space and a digit - if the `ElementName` does not exist at all, use `Description` - If neither of these elements exist, set the `Kind` to "Unknown" Signed-off-by: Jonathon Jongsma <[email protected]>
- Loading branch information