← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1177972] Re: notify.error is not always called when image upload fails

 

** Changed in: glance
       Status: Fix Committed => Fix Released

** Changed in: glance
    Milestone: None => havana-3

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1177972

Title:
  notify.error is not always called when image upload fails

Status in OpenStack Image Registry and Delivery Service (Glance):
  Fix Released

Bug description:
  _upload in glance/api/v1/images.py catches a number of errors and
  cleans up the image if they occur, but only 2 of them send error
  notifications. All errors should be sending notifications.

   482         except exception.Duplicate as e:
   483             msg = _("Attempt to upload duplicate image: %s") % e
   484             LOG.debug(msg)
   485             self._safe_kill(req, image_id)
   486             raise HTTPConflict(explanation=msg, request=req)
   487 
   488         except exception.Forbidden as e:
   489             msg = _("Forbidden upload attempt: %s") % e
   490             LOG.debug(msg)
   491             self._safe_kill(req, image_id)
   492             raise HTTPForbidden(explanation=msg,
   493                                 request=req,
   494                                 content_type="text/plain")
  495 
   496         except exception.StorageFull as e:
   497             msg = _("Image storage media is full: %s") % e
   498             LOG.error(msg)
   499             self._safe_kill(req, image_id)
   500             self.notifier.error('image.upload', msg)
   501             raise HTTPRequestEntityTooLarge(explanation=msg, request=req,
   502                                             content_type='text/plain')
   503 
   504         except exception.StorageWriteDenied as e:
   505             msg = _("Insufficient permissions on image storage media: %s")      % e
   506             LOG.error(msg)
   507             self._safe_kill(req, image_id)
   508             self.notifier.error('image.upload', msg)
   509             raise HTTPServiceUnavailable(explanation=msg, request=req,
   510                                          content_type='text/plain')
   511 512         except exception.ImageSizeLimitExceeded as e:
   513             msg = _("Denying attempt to upload image larger than %d bytes."
   514                     % CONF.image_size_cap)
   515             LOG.info(msg)
   516             self._safe_kill(req, image_id)
   517             raise HTTPRequestEntityTooLarge(explanation=msg, request=req,
   518                                             content_type='text/plain')
   519 
   520         except HTTPError as e:
   521             self._safe_kill(req, image_id)
   522             #NOTE(bcwaldon): Ideally, we would just call 'raise' here,
   523             # but something in the above function calls is affecting the
   524             # exception context and we must explicitly re-raise the
   525             # caught exception.
   526             raise e
   527 
   528         except Exception as e:
   529             LOG.exception(_("Failed to upload image"))
   530             self._safe_kill(req, image_id)
   531             raise HTTPInternalServerError(request=req)
   532

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1177972/+subscriptions