def get_vsphere_location(context, image_id):
 if image_id:
  metadata = IMAGE_API.get(context, image_id, include_locations=True)
  locations = metadata.get('locations')
  if locations:
   for loc in locations:
    loc_url = loc.get('url')
    if (loc_url and loc_url.startswith('vsphere://')):
     return loc_url
 return None

def get_vsphere_location ( context , image_id ) : if image_id : metadata = IMAGE_API . get ( context , image_id , include_locations = True ) locations = metadata . get ( 'locations' ) if locations : for loc in locations : loc_url = loc . get ( 'url' ) if ( loc_url and loc_url . startswith ( 'vsphere://' ) ) : return loc_url return None
get image location in vsphere or none .