Merge "Portback part change of adding status field to image location"
This commit is contained in:
commit
56af7fd60c
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
from stevedore import driver
|
||||
@ -294,30 +293,6 @@ def get_store_from_location(uri):
|
||||
return loc.store_name
|
||||
|
||||
|
||||
def safe_delete_from_backend(uri, image_id, context=None):
|
||||
"""Given a uri, delete an image from the store."""
|
||||
try:
|
||||
return delete_from_backend(uri, context=context)
|
||||
except exceptions.NotFound:
|
||||
msg = _('Failed to delete image %s in store from URI')
|
||||
LOG.warn(msg % image_id)
|
||||
except exceptions.StoreDeleteNotSupported as e:
|
||||
LOG.warn(utils.exception_to_str(e))
|
||||
except exceptions.UnsupportedBackend:
|
||||
exc_type = sys.exc_info()[0].__name__
|
||||
msg = (_('Failed to delete image %(image_id)s '
|
||||
'from store (%(exc_type)s)') %
|
||||
dict(image_id=image_id, exc_type=exc_type))
|
||||
LOG.error(msg)
|
||||
|
||||
|
||||
def _delete_image_from_backend(context, store_api, image_id, uri):
|
||||
if CONF.delayed_delete:
|
||||
store_api.schedule_delayed_delete_from_backend(context, uri, image_id)
|
||||
else:
|
||||
store_api.safe_delete_from_backend(context, uri, image_id)
|
||||
|
||||
|
||||
def check_location_metadata(val, key=''):
|
||||
if isinstance(val, dict):
|
||||
for key in val:
|
||||
|
@ -19,7 +19,6 @@ from glance_store._drivers import http
|
||||
from glance_store import delete_from_backend
|
||||
from glance_store import exceptions
|
||||
from glance_store.location import get_location_from_uri
|
||||
from glance_store import safe_delete_from_backend
|
||||
from glance_store.tests import base
|
||||
from glance_store.tests import utils
|
||||
|
||||
@ -113,10 +112,3 @@ class TestHttpStore(base.StoreBaseTest):
|
||||
self.assertRaises(NotImplementedError, self.store.delete, loc)
|
||||
self.assertRaises(exceptions.StoreDeleteNotSupported,
|
||||
delete_from_backend, uri, {})
|
||||
|
||||
def test_http_schedule_delete_swallows_error(self):
|
||||
uri = "https://netloc/path/to/file.tar.gz"
|
||||
try:
|
||||
safe_delete_from_backend(uri, 'image_id', {})
|
||||
except exceptions.StoreDeleteNotSupported:
|
||||
self.fail('StoreDeleteNotSupported should be swallowed')
|
||||
|
Loading…
Reference in New Issue
Block a user