summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-19 18:45:31 +0000
committerGerrit Code Review <review@openstack.org>2015-09-19 18:45:31 +0000
commitf1b5a1f4c5f1f0755d78f560b282a8145dba0401 (patch)
treea269fbd26efac3c5b33440178e781326a6225e3a
parent227e1f823525a517474e3d1b567ad11c9b95fb16 (diff)
parenta63f70c17d392379ec75045a94c38a96878b4c5c (diff)
downloadswift-f1b5a1f4c5f1f0755d78f560b282a8145dba0401.tar.gz
Merge "Reconstructor logging to omit 404 warnings"
-rw-r--r--swift/obj/reconstructor.py7
-rwxr-xr-xtest/unit/obj/test_reconstructor.py13
2 files changed, 18 insertions, 2 deletions
diff --git a/swift/obj/reconstructor.py b/swift/obj/reconstructor.py
index b6328493b..719cdcf07 100644
--- a/swift/obj/reconstructor.py
+++ b/swift/obj/reconstructor.py
@@ -36,7 +36,8 @@ from swift.common.bufferedhttp import http_connect
from swift.common.daemon import Daemon
from swift.common.ring.utils import is_local_device
from swift.obj.ssync_sender import Sender as ssync_sender
-from swift.common.http import HTTP_OK, HTTP_INSUFFICIENT_STORAGE
+from swift.common.http import HTTP_OK, HTTP_NOT_FOUND, \
+ HTTP_INSUFFICIENT_STORAGE
from swift.obj.diskfile import DiskFileRouter, get_data_dir, \
get_tmp_dir
from swift.common.storage_policy import POLICIES, EC_POLICY
@@ -203,12 +204,14 @@ class ObjectReconstructor(Daemon):
part, 'GET', path, headers=headers)
with Timeout(self.node_timeout):
resp = conn.getresponse()
- if resp.status != HTTP_OK:
+ if resp.status not in [HTTP_OK, HTTP_NOT_FOUND]:
self.logger.warning(
_("Invalid response %(resp)s from %(full_path)s"),
{'resp': resp.status,
'full_path': self._full_path(node, part, path, policy)})
resp = None
+ elif resp.status == HTTP_NOT_FOUND:
+ resp = None
except (Exception, Timeout):
self.logger.exception(
_("Trying to GET %(full_path)s"), {
diff --git a/test/unit/obj/test_reconstructor.py b/test/unit/obj/test_reconstructor.py
index 882ffa862..16aaa0f60 100755
--- a/test/unit/obj/test_reconstructor.py
+++ b/test/unit/obj/test_reconstructor.py
@@ -684,6 +684,19 @@ class TestGlobalSetupObjectReconstructor(unittest.TestCase):
self.assertEqual(
len(self.reconstructor.logger.log_dict['warning']), 1)
+ def test_reconstructor_does_not_log_on_404(self):
+ part = self.part_nums[0]
+ node = POLICIES[0].object_ring.get_part_nodes(int(part))[0]
+ with mocked_http_conn(404):
+ self.reconstructor._get_response(node, part,
+ path='some_path',
+ headers={},
+ policy=POLICIES[0])
+
+ # Make sure that no warnings are emitted for a 404
+ len_warning_lines = len(self.logger.get_lines_for_level('warning'))
+ self.assertEqual(len_warning_lines, 0)
+
def test_reconstructor_skips_bogus_partition_dirs(self):
# A directory in the wrong place shouldn't crash the reconstructor
self.reconstructor._reset_stats()