def _get_vsan_eligible_disks(service_instance, host, host_names):
 ret = {}
 for host_name in host_names:
  host_ref = _get_host_ref(service_instance, host, host_name=host_name)
  vsan_system = host_ref.configManager.vsanSystem
  if (vsan_system is None):
   msg = "VSAN System Config Manager is unset for host '{0}'. VSAN configuration cannot be changed without a configured VSAN System.".format(host_name)
   log.debug(msg)
   ret.update({host_name: {'Error': msg}})
   continue
  suitable_disks = []
  query = vsan_system.QueryDisksForVsan()
  for item in query:
   if (item.state == 'eligible'):
    suitable_disks.append(item)
  if (not suitable_disks):
   msg = "The host '{0}' does not have any VSAN eligible disks.".format(host_name)
   log.warning(msg)
   ret.update({host_name: {'Eligible': msg}})
   continue
  disks = (_get_host_ssds(host_ref) + _get_host_non_ssds(host_ref))
  matching = []
  for disk in disks:
   for suitable_disk in suitable_disks:
    if (disk.canonicalName == suitable_disk.disk.canonicalName):
     matching.append(disk)
  ret.update({host_name: {'Eligible': matching}})
 return ret

def _get_vsan_eligible_disks ( service_instance , host , host_names ) : ret = { } for host_name in host_names : host_ref = _get_host_ref ( service_instance , host , host_name = host_name ) vsan_system = host_ref . configManager . vsanSystem if ( vsan_system is None ) : msg = "VSAN System Config Manager is unset for host '{0}'. VSAN configuration cannot be changed without a configured VSAN System." . format ( host_name ) log . debug ( msg ) ret . update ( { host_name : { 'Error' : msg } } ) continue suitable_disks = [ ] query = vsan_system . QueryDisksForVsan ( ) for item in query : if ( item . state == 'eligible' ) : suitable_disks . append ( item ) if ( not suitable_disks ) : msg = "The host '{0}' does not have any VSAN eligible disks." . format ( host_name ) log . warning ( msg ) ret . update ( { host_name : { 'Eligible' : msg } } ) continue disks = ( _get_host_ssds ( host_ref ) + _get_host_non_ssds ( host_ref ) ) matching = [ ] for disk in disks : for suitable_disk in suitable_disks : if ( disk . canonicalName == suitable_disk . disk . canonicalName ) : matching . append ( disk ) ret . update ( { host_name : { 'Eligible' : matching } } ) return ret
helper function that returns a dictionary of host_name keys with either a list of eligible disks that can be added to vsan or either an error message or a message saying no eligible disks were found .