[
https://issues.apache.org/jira/browse/VCL-929?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andy Kurth resolved VCL-929.
----------------------------
Resolution: Fixed
> VMware.pm does not parse hardware version from .vmdk file correctly
> -------------------------------------------------------------------
>
> Key: VCL-929
> URL: https://issues.apache.org/jira/browse/VCL-929
> Project: VCL
> Issue Type: Bug
> Components: vcld (backend)
> Affects Versions: 2.4.2
> Reporter: Andy Kurth
> Assignee: Andy Kurth
> Fix For: 2.5
>
>
> {{VIM_SSH.pm::get_virtual_disk_hardware_version}} calls the following command
> similar to the following to retrieve the hardware version from a .vmdk file:
> {noformat}
> vim-cmd hostsvc/datastorebrowser/searchsubfolders 0 "[datastore-name]
> vmwarelinux-imagename-v9"{noformat}
> It then parses the output:
> {noformat}
> (vim.host.DatastoreBrowser.SearchResults) [
> (vim.host.DatastoreBrowser.SearchResults) {
> dynamicType = <unset>,
> datastore = 'vim.Datastore:55921f72-785b973c-9fe6-6c0b8462bd80',
> folderPath = "[datastore-name] vmwarelinux-imagename-v9",
> file = (vim.host.DatastoreBrowser.FileInfo) [
> (vim.host.DatastoreBrowser.VmDiskInfo) {
> dynamicType = <unset>,
> path = "vmwarelinux-imagename-v9.vmdk",
> fileSize = 9457106944,
> modification = "2016-02-05T16:58:35Z",
> owner = <unset>,
> diskType = "vim.vm.device.VirtualDisk.FlatVer2BackingInfo",
> capacityKb = 31457280,
> hardwareVersion = 11,
> controllerType = "vim.vm.device.VirtualLsiLogicController",
> diskExtents = (string) [
> "[datastore-name]
> vmwarelinux-imagename-v9/vmwarelinux-imagename-v9-flat.vmdk"
> ],
> thin = true,
> }
> ],
> }
> ]
> {noformat}
> The important string is *hardwareVersion = 11*. The code then extracts the
> part after the equals sign:
> {code}my ($hardware_version) = $disk_info =~
> /\shardwareVersion\s*=\s*(.+)/i;{code}
> At this point, $hardware_version = '11,'. The code does not specifically
> look for an integer at this point because the output may contain something
> such as 'unset,'.
> The code checks for 'unset', then proceeds to extract an integer with the
> following regex:
> {code}$hardware_version =~ s/.*(\d+).*/$1/ig;{code}
> This is problematic because it is not consistently returning only the
> integer. Sometimes it returns 1 and other times 0.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)