← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1185851] Re: glance allows delete even if cannot be deleted from ceph backend store

 

** Project changed: glance => glance-store

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

Title:
  glance allows delete even if cannot be deleted from ceph backend store

Status in OpenStack Glance backend store-drivers library (glance_store):
  In Progress

Bug description:
  The following steps *should* reproduce the issue. Basically, if I have
  a copy-on-write cloned vol from image, glance allows me to delet the
  image from glance itself even if the image cannot be deleted from
  backend store thus requiring manual deletion from Ceph cluster.

  Upload an image to Glance. This will create a snapshot of the raw
  image.

      glance image-create --name="testimage" --is-public="true" --disk-
  format="raw" --container-format="ovf" < precise-server-cloudimg-
  amd64-disk1.img

  Create a cinder volume clone of the image

      nova volume-create --image-id <img-id> --display-name test-vol 4

  When can then see that we have a snaphot image in the glance/images
  pool and a cloned image in the cinder/volumes pool

      rbd -p images ls| grep <img-id> # returns <img-id>
      rbd -p volumes ls| grep vol-<vol-id> # returns vol-<vol-id>

  Now if I delete the glance image...

      glance delete <img-id>

  I get a failure as expected since the snapshot is in use

      Request returned failure status.
      Traceback (most recent call last):
        File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 383, in handle_one_response
          result = self.application(self.environ, start_response)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
          resp = self.call_func(req, *args, **self.kwargs)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
          return self.func(req, *args, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 333, in __call__
          response = req.get_response(self.application)
        File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
          application, catch_exc_info=False)
        File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
          app_iter = application(self.environ, start_response)
        File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 450, in __call__
          return self.app(env, start_response)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
          resp = self.call_func(req, *args, **self.kwargs)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
          return self.func(req, *args, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 333, in __call__
          response = req.get_response(self.application)
        File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
          application, catch_exc_info=False)
        File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
          app_iter = application(self.environ, start_response)
        File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
          return app(environ, start_response)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
          return resp(environ, start_response)
        File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
          response = self.app(environ, start_response)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
          return resp(environ, start_response)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
          resp = self.call_func(req, *args, **self.kwargs)
        File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
          return self.func(req, *args, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 540, in __call__
          request, **action_args)
        File "/usr/lib/python2.7/dist-packages/glance/common/wsgi.py", line 557, in dispatch
          return method(*args, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/common/utils.py", line 413, in wrapped
          return func(self, req, *args, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 861, in delete
          self._initiate_deletion(req, image['location'], id)
        File "/usr/lib/python2.7/dist-packages/glance/api/v1/images.py", line 813, in _initiate_deletion
          safe_delete_from_backend(location, req.context, id)
        File "/usr/lib/python2.7/dist-packages/glance/store/__init__.py", line 257, in safe_delete_from_backend
          return delete_from_backend(context, uri, **kwargs)
        File "/usr/lib/python2.7/dist-packages/glance/store/__init__.py", line 237, in delete_from_backend
          return store.delete(loc)
        File "/usr/lib/python2.7/dist-packages/glance/store/rbd.py", line 284, in delete
          raise exception.InUseByStore()
      InUseByStore: The image cannot be deleted because it is in use through the backend store outside of Glance.
       (HTTP 500)

  But the image has been deleted from glance so there is no trace of it
  other than in Ceph itself

      glance index| grep <img-id> # returns nothing

  Now if I delete the cloned volume...

      nova volume-delete <vol>

  The rbd image is still around and I have no way of deleting it other than going
  into Ceph and manually deleting it.

      rbd -p images ls| grep <img-id> # returns <img-id>
      rbd -p volumes ls| vol-<vol-id> # returns nothing

  I suggest we disallow deleting the image from Glance if it is 'in-use'. Perhaps
  we could even give the user info on who/what is using the image so they can
  resolve dependencies.

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