← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1233097] Re: rbd delete_image does not catch ImageNotFound when deleting snap

 

Reviewed:  https://review.openstack.org/51045
Committed: http://github.com/openstack/glance/commit/1fd64662fe66eda5fee404a37586f30cae2bf785
Submitter: Jenkins
Branch:    milestone-proposed

commit 1fd64662fe66eda5fee404a37586f30cae2bf785
Author: Edward Hope-Morley <edward.hope-morley@xxxxxxxxxxxxx>
Date:   Mon Sep 30 12:22:30 2013 +0100

    Fixes rbd _delete_image snapshot with missing image
    
    Also ignore if _delete_image returns NotFound when cleaning up
    following failed attempt to create a new image with add().
    
    Also added unit tests.
    
    Change-Id: Id66866b4260385a6324cc277c5ac665f81493c89
    Fixes: bug 1233097


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

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

Title:
  rbd delete_image does not catch ImageNotFound when deleting snap

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

Bug description:
  the store.rbd._delete_image() method does not catch rbd.ImageNotFound
  and return exception.NotFound when trying to delete a snapshot. The
  behaviour should be the same as when deleting the image itself.

  This produces errors like this:

  2013-09-30 14:30:10.139 442 ERROR glance.api.v2.image_data [0be083f3-4d9f-4d88-9264-b69ca9bbd2c2 18ab8e3ef26b499a8c581b8f18f2d33f 133f3a73a0294e98aaee00e8139bb922] Failed to upload image data due to internal error
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data Traceback (most recent call last):
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/api/v2/image_data.py", line 55, in upload
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     image.set_data(data, size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/domain/proxy.py", line 126, in set_data
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self.base.set_data(data, size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/notifier/__init__.py", line 202, in set_data
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self.image.set_data(data, size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/domain/proxy.py", line 126, in set_data
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self.base.set_data(data, size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/quota/__init__.py", line 140, in set_data
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self.image.set_data(data, size=size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/store/__init__.py", line 644, in set_data
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self.image.image_id, utils.CooperativeReader(data), size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/store/__init__.py", line 355, in add_to_backend
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     return store_add_to_backend(image_id, data, size, store)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/store/__init__.py", line 333, in store_add_to_backend
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     (location, size, checksum, metadata) = store.add(image_id, data, size)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/store/rbd.py", line 330, in add
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     self._delete_image(loc.image, loc.snapshot)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/mnt/glance/glance/store/rbd.py", line 267, in _delete_image
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     image.unprotect_snap(snapshot_name)
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data   File "/usr/lib/python2.7/dist-packages/rbd.py", line 578, in unprotect_snap
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data     raise make_ex(ret, 'error unprotecting snapshot %s@%s' % (self.name, name))
  2013-09-30 14:30:10.139 442 TRACE glance.api.v2.image_data ImageNotFound: error unprotecting snapshot bccb3478-e7cf-4661-86ba-d405cffe0912@snap

  where we are doing a cleanup but the image may not exist in which case
  we would want to ignore the error.

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