obj: Include timeout value when logging long-running rsyncs
Change-Id: I5f319ce7842152d0cd367559a6108407acd65cc0
This commit is contained in:
parent
14a42d573a
commit
e318d15b8e
@ -385,7 +385,8 @@ class ObjectReplicator(Daemon):
|
|||||||
except Timeout:
|
except Timeout:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
self._limit_rsync_log(
|
self._limit_rsync_log(
|
||||||
_("Killing long-running rsync: %s") % str(args)))
|
_("Killing long-running rsync after %ds: %s") % (
|
||||||
|
self.rsync_timeout, str(args))))
|
||||||
if proc:
|
if proc:
|
||||||
proc.kill()
|
proc.kill()
|
||||||
try:
|
try:
|
||||||
|
@ -2147,7 +2147,7 @@ class TestObjectReplicator(unittest.TestCase):
|
|||||||
mock_http_connect(200)), \
|
mock_http_connect(200)), \
|
||||||
mock.patch.object(self.replicator, 'rsync_timeout', 0.01), \
|
mock.patch.object(self.replicator, 'rsync_timeout', 0.01), \
|
||||||
mock.patch('eventlet.green.subprocess.Popen', new_mock):
|
mock.patch('eventlet.green.subprocess.Popen', new_mock):
|
||||||
self.replicator.rsync_error_log_line_length = 20
|
self.replicator.rsync_error_log_line_length = 40
|
||||||
self.replicator.run_once()
|
self.replicator.run_once()
|
||||||
for proc in mock_procs:
|
for proc in mock_procs:
|
||||||
self.assertEqual(proc._calls, [
|
self.assertEqual(proc._calls, [
|
||||||
@ -2158,8 +2158,8 @@ class TestObjectReplicator(unittest.TestCase):
|
|||||||
self.assertEqual(len(mock_procs), 2)
|
self.assertEqual(len(mock_procs), 2)
|
||||||
error_lines = self.replicator.logger.get_lines_for_level('error')
|
error_lines = self.replicator.logger.get_lines_for_level('error')
|
||||||
# verify logs are truncated to rsync_error_log_line_length
|
# verify logs are truncated to rsync_error_log_line_length
|
||||||
self.assertEqual('Killing long-running', error_lines[0])
|
self.assertEqual(["Killing long-running rsync after 0s: ['r"] * 2,
|
||||||
self.assertEqual('Killing long-running', error_lines[1])
|
error_lines)
|
||||||
|
|
||||||
def test_replicate_rsync_timeout_wedged(self):
|
def test_replicate_rsync_timeout_wedged(self):
|
||||||
cur_part = '0'
|
cur_part = '0'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user