ec: Use replication network to get frags for reconstruction

Closes-Bug: #1946267
Change-Id: Idb4fe7478275f71b4032024d6116181766ac6759
This commit is contained in:
Tim Burke 2021-10-05 14:19:41 -07:00
parent 1cde3938a9
commit a5fbe6ca41
2 changed files with 16 additions and 4 deletions

View File

@ -393,8 +393,9 @@ class ObjectReconstructor(Daemon):
resp = None
try:
with ConnectionTimeout(self.conn_timeout):
conn = http_connect(node['ip'], node['port'], node['device'],
partition, 'GET', path, headers=headers)
conn = http_connect(
node['replication_ip'], node['replication_port'],
node['device'], partition, 'GET', path, headers=headers)
with Timeout(self.node_timeout):
resp = conn.getresponse()
resp.full_path = full_path

View File

@ -780,11 +780,22 @@ class TestGlobalSetupObjectReconstructor(unittest.TestCase):
def test_get_response(self):
part = self.part_nums[0]
node = self.policy.object_ring.get_part_nodes(int(part))[0]
# separate replication network
node['replication_port'] = node['port'] + 1000
def do_test(stat_code):
with mocked_http_conn(stat_code):
with mocked_http_conn(stat_code) as mock_conn:
resp = self.reconstructor._get_response(
node, self.policy, part, path='nada', headers={})
node, self.policy, part, path='/nada', headers={})
self.assertEqual(mock_conn.requests, [{
'ssl': False,
'ip': node['replication_ip'],
'port': node['replication_port'],
'method': 'GET',
'path': '/sda0/%s/nada' % part,
'qs': None,
'headers': {},
}])
return resp
for status in (200, 400, 404, 503):