From c6cb84bd63135d62ccd7ed9b23b245c41e9f105c Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Wed, 24 Jan 2018 17:00:19 +0100 Subject: [PATCH] Remove logging on Swift backup obj writer Since change I1f1d9c0d6e3f04f1ecd5ef7c5d813005ee116409 we are running parts of the backups on native threads, which due to an eventlet bug [1] have bad interactions with greenthreads, so we have to avoid any logging when executing code in a native thread. This patch removes the MD5 logging on the SwiftObjectWriter close method and adds comments and docstring referring to this limitation. [1] https://github.com/eventlet/eventlet/issues/432 Closes-Bug: #1745168 Change-Id: I0857cecd7d8ab0ee7e3e9bd6e15f4987ede4d653 --- cinder/backup/chunkeddriver.py | 20 +++++++++++++++++--- cinder/backup/drivers/swift.py | 4 ---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cinder/backup/chunkeddriver.py b/cinder/backup/chunkeddriver.py index 1752f12e663..a5436154244 100644 --- a/cinder/backup/chunkeddriver.py +++ b/cinder/backup/chunkeddriver.py @@ -56,6 +56,11 @@ CONF = cfg.CONF CONF.register_opts(chunkedbackup_service_opts) +# Object writer and reader returned by inheriting classes must not have any +# logging calls, as well as the compression libraries, as eventlet has a bug +# (https://github.com/eventlet/eventlet/issues/432) that would result in +# failures. + @six.add_metaclass(abc.ABCMeta) class ChunkedBackupDriver(driver.BackupDriver): """Abstract chunked backup driver. @@ -138,14 +143,23 @@ class ChunkedBackupDriver(driver.BackupDriver): def get_object_writer(self, container, object_name, extra_metadata=None): """Returns a writer object which stores the chunk data in backup repository. - The object returned should be a context handler that can be used - in a "with" context. + The object returned should be a context handler that can be used in a + "with" context. + + The object writer methods must not have any logging calls, as eventlet + has a bug (https://github.com/eventlet/eventlet/issues/432) that would + result in failures. """ return @abc.abstractmethod def get_object_reader(self, container, object_name, extra_metadata=None): - """Returns a reader object for the backed up chunk.""" + """Returns a reader object for the backed up chunk. + + The object reader methods must not have any logging calls, as eventlet + has a bug (https://github.com/eventlet/eventlet/issues/432) that would + result in failures. + """ return @abc.abstractmethod diff --git a/cinder/backup/drivers/swift.py b/cinder/backup/drivers/swift.py index 270d032e337..2d2d013130e 100644 --- a/cinder/backup/drivers/swift.py +++ b/cinder/backup/drivers/swift.py @@ -281,11 +281,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver): content_length=len(self.data)) except socket.error as err: raise exception.SwiftConnectionFailed(reason=err) - LOG.debug('swift MD5 for %(object_name)s: %(etag)s', - {'object_name': self.object_name, 'etag': etag, }) md5 = hashlib.md5(self.data).hexdigest() - LOG.debug('backup MD5 for %(object_name)s: %(md5)s', - {'object_name': self.object_name, 'md5': md5}) if etag != md5: err = _('error writing object to swift, MD5 of object in ' 'swift %(etag)s is not the same as MD5 of object sent '