def get_vmdk_path_and_adapter_type(hardware_devices):
 if (hardware_devices.__class__.__name__ == 'ArrayOfVirtualDevice'):
  hardware_devices = hardware_devices.VirtualDevice
 vmdk_file_path = None
 vmdk_controler_key = None
 disk_type = None
 unit_number = 0
 adapter_type_dict = {}
 for device in hardware_devices:
  if (device.__class__.__name__ == 'VirtualDisk'):
   if (device.backing.__class__.__name__ == 'VirtualDiskFlatVer2BackingInfo'):
    vmdk_file_path = device.backing.fileName
    vmdk_controler_key = device.controllerKey
    if getattr(device.backing, 'thinProvisioned', False):
     disk_type = 'thin'
    elif getattr(device.backing, 'eagerlyScrub', False):
     disk_type = 'eagerZeroedThick'
    else:
     disk_type = 'preallocated'
   if (device.unitNumber > unit_number):
    unit_number = device.unitNumber
  elif (device.__class__.__name__ == 'VirtualLsiLogicController'):
   adapter_type_dict[device.key] = 'lsiLogic'
  elif (device.__class__.__name__ == 'VirtualBusLogicController'):
   adapter_type_dict[device.key] = 'busLogic'
  elif (device.__class__.__name__ == 'VirtualIDEController'):
   adapter_type_dict[device.key] = 'ide'
  elif (device.__class__.__name__ == 'VirtualLsiLogicSASController'):
   adapter_type_dict[device.key] = 'lsiLogic'
 adapter_type = adapter_type_dict.get(vmdk_controler_key, '')
 return (vmdk_file_path, vmdk_controler_key, adapter_type, disk_type, unit_number)

def get_vmdk_path_and_adapter_type ( hardware_devices ) : if ( hardware_devices . __class__ . __name__ == 'ArrayOfVirtualDevice' ) : hardware_devices = hardware_devices . VirtualDevice vmdk_file_path = None vmdk_controler_key = None disk_type = None unit_number = 0 adapter_type_dict = { } for device in hardware_devices : if ( device . __class__ . __name__ == 'VirtualDisk' ) : if ( device . backing . __class__ . __name__ == 'VirtualDiskFlatVer2BackingInfo' ) : vmdk_file_path = device . backing . fileName vmdk_controler_key = device . controllerKey if getattr ( device . backing , 'thinProvisioned' , False ) : disk_type = 'thin' elif getattr ( device . backing , 'eagerlyScrub' , False ) : disk_type = 'eagerZeroedThick' else : disk_type = 'preallocated' if ( device . unitNumber > unit_number ) : unit_number = device . unitNumber elif ( device . __class__ . __name__ == 'VirtualLsiLogicController' ) : adapter_type_dict [ device . key ] = 'lsiLogic' elif ( device . __class__ . __name__ == 'VirtualBusLogicController' ) : adapter_type_dict [ device . key ] = 'busLogic' elif ( device . __class__ . __name__ == 'VirtualIDEController' ) : adapter_type_dict [ device . key ] = 'ide' elif ( device . __class__ . __name__ == 'VirtualLsiLogicSASController' ) : adapter_type_dict [ device . key ] = 'lsiLogic' adapter_type = adapter_type_dict . get ( vmdk_controler_key , '' ) return ( vmdk_file_path , vmdk_controler_key , adapter_type , disk_type , unit_number )
gets the vmdk file path and the storage adapter type .