Ignore 404 on swift object delete

We occasionally see cases where the swift backend gets out of sync
with the object list.  In that case, issuing a delete to an object
will return a 404.  It should be fine to ignore that case.

Change-Id: I3c6cc8f1fdfd5ad286cf85aa4657cbaf4499e1a1
This commit is contained in:
James E. Blair 2024-11-15 08:28:18 -08:00
parent 66bf00a416
commit aa4a1be00b

View File

@ -152,9 +152,18 @@ class SwiftDriver(storageutils.StorageDriver):
return size, ret.iter_content(chunk_size=SWIFT_CHUNK_SIZE)
def delete_object(self, path):
retry_function(
lambda: self.conn.session.delete(
self.get_url(path)))
try:
retry_function(
lambda: self.conn.session.delete(
self.get_url(path)))
except keystoneauth1.exceptions.http.NotFound:
# We have seen instances where the swift object list is
# apparently not in sync with the backend. If we get a
# 404 when deleting an object, it will typically no longer
# show up in object lists after that, so we can safely
# ignore the error. Log it here so we have some
# visibility.
self.log.debug("NotFound error when deleting %s", path)
def move_object(self, src_path, dst_path, uuid=None):
dst = os.path.join(self.container_name, dst_path)