image data not deleted while deleting image in v2 api

Bug #1316233 reported by Nikhil Komawar on 2014-05-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Undecided
Jesse J. Cook

Bug Description

This is reopen for the bug 1039897 ( https://bugs.launchpad.net/glance/+bug/1039897 ). Description as per the old bugs description.

Seems the code has been changed since that got merged in and needs a fix again.

Changed in glance:
assignee: nobody → Jesse J. Cook (jesse-j-cook)
Erno Kuvaja (jokke) wrote :

Jesse,

Any progress on this? Will there be a fix for J-3? (this bug is flagged in the priority list https://etherpad.openstack.org/p/j3-glance-patches )

tags: added: backend
Jesse J. Cook (jesse-j-cook) wrote :

Erno,

I will be looking at it this afternoon. Sorry for not getting to it sooner.

Thanks,

Jesse

Changed in glance:
status: New → In Progress
Jesse J. Cook (jesse-j-cook) wrote :

It looks like the regression was here 6d279251c841b90660f92a553b2a95544e59b328. I should know for sure here shortly. If so, I will reintroduce the code that was regressed.

Jesse J. Cook (jesse-j-cook) wrote :
Download full text (11.5 KiB)

While the code path is a little absurd, it appears that the correct code is being executed on master (2e7de07c5a7c8f9d11c00499f7e85ac30f71d025):

(.venv)# python -m testtools.run glance.tests.unit.v2.test_images_resource.TestImagesController.test_delayed_delete
Tests running...
> glance/api/v2/images.py(198)delete()
-> image.delete()
(Pdb) bt
  /usr/lib/python2.7/runpy.py(162)_run_module_as_main()
-> "__main__", fname, loader, pkg_name)
  /usr/lib/python2.7/runpy.py(72)_run_code()
-> exec code in run_globals
  .venv/lib/python2.7/site-packages/testtools/run.py(535)<module>()
-> main(sys.argv, sys.stdout)
  .venv/lib/python2.7/site-packages/testtools/run.py(532)main()
-> stdout=stdout)
  .venv/lib/python2.7/site-packages/testtools/run.py(232)__init__()
-> self.runTests()
  .venv/lib/python2.7/site-packages/testtools/run.py(384)runTests()
-> self.result = testRunner.run(self.test)
  .venv/lib/python2.7/site-packages/testtools/run.py(104)run()
-> return test.run(result)
  /usr/lib/python2.7/unittest/suite.py(108)run()
-> test(result)
  /usr/lib/python2.7/unittest/suite.py(70)__call__()
-> return self.run(*args, **kwds)
  /usr/lib/python2.7/unittest/suite.py(108)run()
-> test(result)
  /usr/lib/python2.7/unittest/case.py(396)__call__()
-> return self.run(*args, **kwds)
  .venv/local/lib/python2.7/site-packages/testtools/testcase.py(602)run()
-> return run_test.run(result)
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(80)run()
-> return self._run_one(actual_result)
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(94)_run_one()
-> return self._run_prepared_result(ExtendedToOriginalDecorator(result))
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(106)_run_prepared_result()
-> self._run_core()
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(142)_run_core()
-> self.case._run_test_method, self.result):
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(189)_run_user()
-> return fn(*args, **kwargs)
  .venv/local/lib/python2.7/site-packages/testtools/testcase.py(650)_run_test_method()
-> return self._get_test_method()()
  glance/tests/unit/v2/test_images_resource.py(1763)test_delayed_delete()
-> self.controller.delete(request, UUID1)
  glance/common/utils.py(449)wrapped()
-> return func(self, req, *args, **kwargs)
> glance/api/v2/images.py(198)delete()
-> image.delete()
(Pdb) l
193 image_repo = self.gateway.get_repo(req.context)
194 try:
195 image = image_repo.get(image_id)
196 import pdb
197 pdb.set_trace()
198 -> image.delete()
199 image_repo.remove(image)
200 except exception.Forbidden as e:
201 raise webob.exc.HTTPForbidden(explanation=e.msg)
202 except exception.NotFound as e:
203 msg = (_("Failed to find image %(image_id)s to delete") %
(Pdb) cont
> glance/location.py(346)delete()
-> self.image.delete()
(Pdb) bt
  /usr/lib/python2.7/runpy.py(162)_run_module_as_main()
-> "__main__", fname, loader, pkg_name)
  /usr/lib/python2.7/runpy.py(72)_run_code()
-> exec code in run_globals
  .venv/lib/python2.7/site-packages/testtool...

Jesse J. Cook (jesse-j-cook) wrote :

Do we have steps to reproduce this?

Nikhil Komawar (nikhil-komawar) wrote :

A couple of questions:

1. The trace seems to indicate testing only the delayed delete operation, is that so or am I missing something?
2. Do we know if the backend storage delete operation is being performed? (Particularly swift)

Jesse J. Cook (jesse-j-cook) wrote :
Download full text (14.4 KiB)

Here's a trace doing the sync delete (it's hitting a mock at the end of the trace, but the code path looks correct):

(.venv)# python -m testtools.run glance.tests.unit.v2.test_images_resource.TestImagesController.test_delete
Tests running...
> glance/api/v2/images.py(198)delete()
-> image.delete()
(Pdb) bt
  /usr/lib/python2.7/runpy.py(162)_run_module_as_main()
-> "__main__", fname, loader, pkg_name)
  /usr/lib/python2.7/runpy.py(72)_run_code()
-> exec code in run_globals
  .venv/lib/python2.7/site-packages/testtools/run.py(535)<module>()
-> main(sys.argv, sys.stdout)
  .venv/lib/python2.7/site-packages/testtools/run.py(532)main()
-> stdout=stdout)
  .venv/lib/python2.7/site-packages/testtools/run.py(232)__init__()
-> self.runTests()
  .venv/lib/python2.7/site-packages/testtools/run.py(384)runTests()
-> self.result = testRunner.run(self.test)
  .venv/lib/python2.7/site-packages/testtools/run.py(104)run()
-> return test.run(result)
  /usr/lib/python2.7/unittest/suite.py(108)run()
-> test(result)
  /usr/lib/python2.7/unittest/suite.py(70)__call__()
-> return self.run(*args, **kwds)
  /usr/lib/python2.7/unittest/suite.py(108)run()
-> test(result)
  /usr/lib/python2.7/unittest/case.py(396)__call__()
-> return self.run(*args, **kwds)
  .venv/local/lib/python2.7/site-packages/testtools/testcase.py(602)run()
-> return run_test.run(result)
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(80)run()
-> return self._run_one(actual_result)
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(94)_run_one()
-> return self._run_prepared_result(ExtendedToOriginalDecorator(result))
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(106)_run_prepared_result()
-> self._run_core()
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(142)_run_core()
-> self.case._run_test_method, self.result):
  .venv/local/lib/python2.7/site-packages/testtools/runtest.py(189)_run_user()
-> return fn(*args, **kwargs)
  .venv/local/lib/python2.7/site-packages/testtools/testcase.py(650)_run_test_method()
-> return self._get_test_method()()
  glance/tests/unit/v2/test_images_resource.py(1700)test_delete()
-> self.controller.delete(request, UUID1)
  glance/common/utils.py(449)wrapped()
-> return func(self, req, *args, **kwargs)
> glance/api/v2/images.py(198)delete()
-> image.delete()
(Pdb) l
193 image_repo = self.gateway.get_repo(req.context)
194 try:
195 image = image_repo.get(image_id)
196 import pdb
197 pdb.set_trace()
198 -> image.delete()
199 image_repo.remove(image)
200 except exception.Forbidden as e:
201 raise webob.exc.HTTPForbidden(explanation=e.msg)
202 except exception.NotFound as e:
203 msg = (_("Failed to find image %(image_id)s to delete") %
(Pdb) cont
> glance/location.py(346)delete()
-> self.image.delete()
(Pdb) bt
  /usr/lib/python2.7/runpy.py(162)_run_module_as_main()
-> "__main__", fname, loader, pkg_name)
  /usr/lib/python2.7/runpy.py(72)_run_code()
-> exec code in run_globals
  .venv/lib/python2.7/site-packages/testtools/run.py(535)<module>()
-> main(sys.argv, sy...

Jesse J. Cook (jesse-j-cook) wrote :

I will try to manually reproduce this bug.

Jesse J. Cook (jesse-j-cook) wrote :

Code worked correctly in attempts to manually reproduce. CNR.

Changed in glance:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers