notify.error is not always called when image upload fails

Bug #1177972 reported by Alex Meade
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Jared Culp

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

Alex Meade (alex-meade)
Changed in glance:
importance: Undecided → Low
Alex Meade (alex-meade)
Changed in glance:
assignee: Alex Meade (alex-meade) → Jared Culp (jared-culp)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/33856

Revision history for this message
Jared Culp (jared-culp) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/33856
Committed: http://github.com/openstack/glance/commit/89222a30d5224be0775c526ca36c7e5cd106a2d3
Submitter: Jenkins
Branch: master

commit 89222a30d5224be0775c526ca36c7e5cd106a2d3
Author: Jared Culp <email address hidden>
Date: Tue Jul 9 11:46:41 2013 -0400

    Notify does not occur on all image upload fails

    Some exceptions did not have notifications sent after exception is caught.

    Fixes bug #1177972

    Change-Id: I86ba420c924d01153d5afdfc732239d1934175f8

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-3
status: Fix Committed → Fix Released
Revision history for this message
Yang Yu (yuyangbj) wrote : I will be on vacation from 9/5 to 9/15, urgent call: 13811509950

I will be out of the office starting 2013-09-05 and will not return until
2013-09-15.

I will be on my marriage leave from 9/5 to 9/15, for any urgent issue
please call me before 9/7.

For daily work, please ask my scrum master Zhu Zhu for help.
For glance issue, please ask glance SME Feilong Wang for help.
For defect report, there will be no report next week.

Thierry Carrez (ttx)
Changed in glance:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.