relinker: Add policy to relinker progress output
The partition progress logging line currently includes device, step and the progress of partitions. But if your running a part-power increase on more then one policy at a time, then we're missing a crucial piece of information, the policy. This patch add the policy to the log line too: Step: cleanup Device: sda1 Policy: <policy name> Partitions: 1/2 Change-Id: I1dd3362b0a35592867ddaaa86dfa9d95e241373a
This commit is contained in:
parent
31e27a168a
commit
0e4289fbd6
@ -244,9 +244,10 @@ class Relinker(object):
|
||||
num_parts_done = sum(
|
||||
1 for part in self.states["state"].values()
|
||||
if part)
|
||||
self.logger.info("Device: %s Step: %s Partitions: %d/%d" % (
|
||||
device, STEP_CLEANUP if self.do_cleanup else STEP_RELINK,
|
||||
num_parts_done, len(self.states["state"])))
|
||||
step = STEP_CLEANUP if self.do_cleanup else STEP_RELINK
|
||||
num_total_parts = len(self.states["state"])
|
||||
self.logger.info("Step: %s Device: %s Policy: %s Partitions: %d/%d" % (
|
||||
step, device, self.policy.name, num_parts_done, num_total_parts))
|
||||
|
||||
def hashes_filter(self, suff_path, hashes):
|
||||
hashes = list(hashes)
|
||||
|
@ -947,7 +947,7 @@ class TestRelinker(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
['Processing files for policy platinum under %s (cleanup=False)'
|
||||
% self.devices,
|
||||
'Device: sda1 Step: relink Partitions: 1/3',
|
||||
'Step: relink Device: sda1 Policy: platinum Partitions: 1/3',
|
||||
'1 hash dirs processed (cleanup=False) (1 files, 1 linked, '
|
||||
'0 removed, 0 errors)'],
|
||||
self.logger.get_lines_for_level('info')
|
||||
@ -981,8 +981,8 @@ class TestRelinker(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
['Processing files for policy platinum under %s (cleanup=False)'
|
||||
% self.devices,
|
||||
'Device: sda1 Step: relink Partitions: 2/3',
|
||||
'Device: sda1 Step: relink Partitions: 3/3',
|
||||
'Step: relink Device: sda1 Policy: platinum Partitions: 2/3',
|
||||
'Step: relink Device: sda1 Policy: platinum Partitions: 3/3',
|
||||
'2 hash dirs processed (cleanup=False) (2 files, 2 linked, '
|
||||
'0 removed, 0 errors)'],
|
||||
self.logger.get_lines_for_level('info')
|
||||
@ -1062,7 +1062,7 @@ class TestRelinker(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
['Processing files for policy gold under %s/%s (cleanup=False)'
|
||||
% (self.devices, self.existing_device),
|
||||
'Device: sda1 Step: relink Partitions: 1/1',
|
||||
'Step: relink Device: sda1 Policy: gold Partitions: 1/1',
|
||||
'1 hash dirs processed (cleanup=False) (1 files, 1 linked, '
|
||||
'0 removed, 0 errors)'],
|
||||
self.logger.get_lines_for_level('info'))
|
||||
@ -1814,7 +1814,8 @@ class TestRelinker(unittest.TestCase):
|
||||
# Ack partition 96
|
||||
r.hook_post_partition(os.path.join(datadir_path, '96'))
|
||||
self.assertEqual(r.states["state"], {'96': True, '227': False})
|
||||
self.assertIn("Device: sda1 Step: relink Partitions: 1/2",
|
||||
self.assertIn("Step: relink Device: sda1 Policy: %s "
|
||||
"Partitions: 1/2" % r.policy.name,
|
||||
self.logger.get_lines_for_level("info"))
|
||||
with open(state_file, 'rt') as f:
|
||||
self.assertEqual(json.load(f), {
|
||||
@ -1829,7 +1830,8 @@ class TestRelinker(unittest.TestCase):
|
||||
|
||||
# Ack partition 227
|
||||
r.hook_post_partition(os.path.join(datadir_path, '227'))
|
||||
self.assertIn("Device: sda1 Step: relink Partitions: 2/2",
|
||||
self.assertIn("Step: relink Device: sda1 Policy: %s "
|
||||
"Partitions: 2/2" % r.policy.name,
|
||||
self.logger.get_lines_for_level("info"))
|
||||
self.assertEqual(r.states["state"], {'96': True, '227': True})
|
||||
with open(state_file, 'rt') as f:
|
||||
@ -1872,7 +1874,8 @@ class TestRelinker(unittest.TestCase):
|
||||
r.partitions_filter("", ['96', '227', '312']))
|
||||
# Ack partition 227
|
||||
r.hook_post_partition(os.path.join(datadir_path, '227'))
|
||||
self.assertIn("Device: sda1 Step: cleanup Partitions: 1/2",
|
||||
self.assertIn("Step: cleanup Device: sda1 Policy: %s "
|
||||
"Partitions: 1/2" % r.policy.name,
|
||||
self.logger.get_lines_for_level("info"))
|
||||
self.assertEqual(r.states["state"],
|
||||
{'96': False, '227': True})
|
||||
@ -1890,7 +1893,8 @@ class TestRelinker(unittest.TestCase):
|
||||
|
||||
# Ack partition 96
|
||||
r.hook_post_partition(os.path.join(datadir_path, '96'))
|
||||
self.assertIn("Device: sda1 Step: cleanup Partitions: 2/2",
|
||||
self.assertIn("Step: cleanup Device: sda1 Policy: %s "
|
||||
"Partitions: 2/2" % r.policy.name,
|
||||
self.logger.get_lines_for_level("info"))
|
||||
self.assertEqual(r.states["state"],
|
||||
{'96': True, '227': True})
|
||||
|
Loading…
x
Reference in New Issue
Block a user