def list_clusters_by_datacenter(kwargs=None, call=None):
 if (call != 'function'):
  raise SaltCloudSystemExit('The list_clusters_by_datacenter function must be called with -f or --function.')
 ret = {}
 datacenter_name = (kwargs.get('datacenter') if (kwargs and ('datacenter' in kwargs)) else None)
 datacenter_properties = ['name']
 datacenter_list = salt.utils.vmware.get_mors_with_properties(_get_si(), vim.Datacenter, datacenter_properties)
 for datacenter in datacenter_list:
  ret[datacenter['name']] = []
  for cluster in datacenter['object'].hostFolder.childEntity:
   if isinstance(cluster, vim.ClusterComputeResource):
    ret[datacenter['name']].append(cluster.name)
  if (datacenter_name and (datacenter_name == datacenter['name'])):
   return {'Clusters by Datacenter': {datacenter_name: ret[datacenter_name]}}
 return {'Clusters by Datacenter': ret}

def list_clusters_by_datacenter ( kwargs = None , call = None ) : if ( call != 'function' ) : raise SaltCloudSystemExit ( 'The list_clusters_by_datacenter function must be called with -f or --function.' ) ret = { } datacenter_name = ( kwargs . get ( 'datacenter' ) if ( kwargs and ( 'datacenter' in kwargs ) ) else None ) datacenter_properties = [ 'name' ] datacenter_list = salt . utils . vmware . get_mors_with_properties ( _get_si ( ) , vim . Datacenter , datacenter_properties ) for datacenter in datacenter_list : ret [ datacenter [ 'name' ] ] = [ ] for cluster in datacenter [ 'object' ] . hostFolder . childEntity : if isinstance ( cluster , vim . ClusterComputeResource ) : ret [ datacenter [ 'name' ] ] . append ( cluster . name ) if ( datacenter_name and ( datacenter_name == datacenter [ 'name' ] ) ) : return { 'Clusters by Datacenter' : { datacenter_name : ret [ datacenter_name ] } } return { 'Clusters by Datacenter' : ret }
list clusters for each datacenter; or clusters for a specified datacenter in this vmware environment to list clusters for each datacenter: cli example: .