Change partition name from string to integer
Object-replicator let user to input target partition numbers and run the replicator job, and partition input will be stored as integer list. But in build_replication_jobs method, it use os.listdir method to retreve partitions in string list, so it is failed to compare with target partition numbers. Change-Id: I85dcaf65b9f19ac4659fa5937f9b0b0e804fc54e Closes-Bug: #1822731
This commit is contained in:
parent
20f53a3df7
commit
08d59ebcd4
@ -817,8 +817,8 @@ class ObjectReplicator(Daemon):
|
||||
self.logger.exception('ERROR creating %s' % obj_path)
|
||||
continue
|
||||
for partition in os.listdir(obj_path):
|
||||
if (override_partitions is not None
|
||||
and partition not in override_partitions):
|
||||
if (override_partitions is not None and partition.isdigit()
|
||||
and int(partition) not in override_partitions):
|
||||
continue
|
||||
|
||||
if (partition.startswith('auditor_status_') and
|
||||
|
@ -1401,10 +1401,10 @@ class TestObjectReplicator(unittest.TestCase):
|
||||
self.assertTrue(os.access(part_path, os.F_OK))
|
||||
self.replicator.replicate(override_devices=['sdb'])
|
||||
self.assertTrue(os.access(part_path, os.F_OK))
|
||||
self.replicator.replicate(override_partitions=['9'])
|
||||
self.replicator.replicate(override_partitions=[9])
|
||||
self.assertTrue(os.access(part_path, os.F_OK))
|
||||
self.replicator.replicate(override_devices=['sda'],
|
||||
override_partitions=['1'])
|
||||
override_partitions=[1])
|
||||
self.assertFalse(os.access(part_path, os.F_OK))
|
||||
|
||||
def test_delete_policy_override_params(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user