def image_send_notification(bytes_written, expected_size, image_meta, request, notifier):
 try:
  context = request.context
  payload = {'bytes_sent': bytes_written, 'image_id': image_meta['id'], 'owner_id': image_meta['owner'], 'receiver_tenant_id': context.tenant, 'receiver_user_id': context.user, 'destination_ip': request.remote_addr}
  if (bytes_written != expected_size):
   notify = notifier.error
  else:
   notify = notifier.info
  notify('image.send', payload)
 except Exception as err:
  msg = (_LE('An error occurred during image.send notification: %(err)s') % {'err': err})
  LOG.error(msg)

def image_send_notification ( bytes_written , expected_size , image_meta , request , notifier ) : try : context = request . context payload = { 'bytes_sent' : bytes_written , 'image_id' : image_meta [ 'id' ] , 'owner_id' : image_meta [ 'owner' ] , 'receiver_tenant_id' : context . tenant , 'receiver_user_id' : context . user , 'destination_ip' : request . remote_addr } if ( bytes_written != expected_size ) : notify = notifier . error else : notify = notifier . info notify ( 'image.send' , payload ) except Exception as err : msg = ( _LE ( 'An error occurred during image.send notification: %(err)s' ) % { 'err' : err } ) LOG . error ( msg )
send an image .