Improves log message in swift.obj.replicator

Before this commit, when a local device has not found been found
in a object-replication run, the policy was not mentioned in the
error log. But it is of interest to know the policy, for example for
error searching, when no local device has been found.

Change-Id: Icb9f9f1d4aec5c4a70dd8abdf5483d4816720418
This commit is contained in:
Christopher Bartz 2016-05-03 14:33:05 +02:00
parent 2bf5eb775f
commit b3dd6a5df1
2 changed files with 8 additions and 7 deletions

View File

@ -642,9 +642,10 @@ class ObjectReplicator(Daemon):
if failure_dev])
continue
if not found_local:
self.logger.error("Can't find itself %s with port %s in ring "
"file, not replicating",
", ".join(ips), self.port)
self.logger.error("Can't find itself in policy with index %d with"
" ips %s and with port %s in ring file, not"
" replicating",
int(policy), ", ".join(ips), self.port)
return jobs
def collect_jobs(self, override_devices=None, override_partitions=None,

View File

@ -267,10 +267,10 @@ class TestObjectReplicator(unittest.TestCase):
logger=self.logger)
replicator.run_once()
expected = [
"Can't find itself 1.1.1.1 with port 6200 "
"in ring file, not replicating",
"Can't find itself 1.1.1.1 with port 6200 "
"in ring file, not replicating",
"Can't find itself in policy with index 0 with ips 1.1.1.1 and"
" with port 6200 in ring file, not replicating",
"Can't find itself in policy with index 1 with ips 1.1.1.1 and"
" with port 6200 in ring file, not replicating",
]
self.assertEqual(expected, self.logger.get_lines_for_level('error'))