def _update_datacenter_cache_from_objects(session, dcs):
 while dcs:
  for dco in dcs.objects:
   dc_ref = dco.obj
   ds_refs = []
   prop_dict = vm_util.propset_dict(dco.propSet)
   name = prop_dict.get('name')
   vmFolder = prop_dict.get('vmFolder')
   datastore_refs = prop_dict.get('datastore')
   if datastore_refs:
    datastore_refs = datastore_refs.ManagedObjectReference
    for ds in datastore_refs:
     ds_refs.append(ds.value)
   else:
    LOG.debug("Datacenter %s doesn't have any datastore associated with it, ignoring it", name)
   for ds_ref in ds_refs:
    _DS_DC_MAPPING[ds_ref] = DcInfo(ref=dc_ref, name=name, vmFolder=vmFolder)
  dcs = session._call_method(vutil, 'continue_retrieval', dcs)

def _update_datacenter_cache_from_objects ( session , dcs ) : while dcs : for dco in dcs . objects : dc_ref = dco . obj ds_refs = [ ] prop_dict = vm_util . propset_dict ( dco . propSet ) name = prop_dict . get ( 'name' ) vmFolder = prop_dict . get ( 'vmFolder' ) datastore_refs = prop_dict . get ( 'datastore' ) if datastore_refs : datastore_refs = datastore_refs . ManagedObjectReference for ds in datastore_refs : ds_refs . append ( ds . value ) else : LOG . debug ( "Datacenter %s doesn't have any datastore associated with it, ignoring it" , name ) for ds_ref in ds_refs : _DS_DC_MAPPING [ ds_ref ] = DcInfo ( ref = dc_ref , name = name , vmFolder = vmFolder ) dcs = session . _call_method ( vutil , 'continue_retrieval' , dcs )
updates the datastore/datacenter cache .