[Backup] Ignore 404 error when deleting swift objects

Change-Id: I451551b7cb4e812d81b1341c5b82da3abf7b8d86
This commit is contained in:
Lingxian Kong 2020-09-17 11:36:28 +12:00
parent 695a63e228
commit f31ac7463a
1 changed files with 7 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import json
from oslo_log import log as logging
import six
import swiftclient
from trove.common import cfg
from trove.common.clients import create_swift_client
@ -207,8 +208,12 @@ class SwiftStorage(base.Storage):
# Delete the old segment file that was copied
LOG.debug('Deleting the old segment file %s.',
stream_reader.first_segment)
self.connection.delete_object(BACKUP_CONTAINER,
stream_reader.first_segment)
try:
self.connection.delete_object(BACKUP_CONTAINER,
stream_reader.first_segment)
except swiftclient.exceptions.ClientException as e:
if e.http_status != 404:
raise
final_swift_checksum = segment_result['etag']
# Validate the object by comparing checksums