From 55cdb55075657c283ce786ca634f8a42ec786490 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 22 Jan 2020 11:00:18 -0800 Subject: [PATCH] Lower the log level for falling back to mkstemp We recently started trying to use O_TMPFILE without the kernel version check, we gracefully degrade when it isn't available, and we don't give operators any way to avoid the O_TMPFILE attempt -- logging at warning seems way too noisy. Change-Id: I8f42127fd6eb930282161930c65e8614f3e3175f Related-Change: I3599e2ab257bcd99467aee83b747939afac639d8 --- swift/obj/diskfile.py | 2 +- test/unit/obj/test_diskfile.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/swift/obj/diskfile.py b/swift/obj/diskfile.py index ed9bac5e6d..3c3c2bd5a6 100644 --- a/swift/obj/diskfile.py +++ b/swift/obj/diskfile.py @@ -1696,7 +1696,7 @@ class BaseDiskFileWriter(object): msg = 'open(%s, O_TMPFILE | O_WRONLY) failed: %s \ Falling back to using mkstemp()' \ % (self._datadir, os.strerror(err.errno)) - self.logger.warning(msg) + self.logger.debug(msg) self.manager.use_linkat = False else: raise diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py index ecc8c3beab..a86dbe01b2 100644 --- a/test/unit/obj/test_diskfile.py +++ b/test/unit/obj/test_diskfile.py @@ -5217,7 +5217,11 @@ class DiskFileMixin(BaseDiskFileTestMixin): # Once opening file with O_TMPFILE has failed, # failure is cached to not try again self.assertFalse(df.manager.use_linkat) + # Now that we try to use O_TMPFILE all the time, log at debug + # instead of warning log = df.manager.logger.get_lines_for_level('warning') + self.assertFalse(log) + log = df.manager.logger.get_lines_for_level('debug') self.assertGreater(len(log), 0) self.assertTrue('O_TMPFILE' in log[-1])