From a5fbe6ca41fbc66a0952f9430744fc3f552b335d Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 5 Oct 2021 14:19:41 -0700 Subject: [PATCH] ec: Use replication network to get frags for reconstruction Closes-Bug: #1946267 Change-Id: Idb4fe7478275f71b4032024d6116181766ac6759 --- swift/obj/reconstructor.py | 5 +++-- test/unit/obj/test_reconstructor.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/swift/obj/reconstructor.py b/swift/obj/reconstructor.py index edd9aec15b..4b444cd44a 100644 --- a/swift/obj/reconstructor.py +++ b/swift/obj/reconstructor.py @@ -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 diff --git a/test/unit/obj/test_reconstructor.py b/test/unit/obj/test_reconstructor.py index 7ef1460fb9..a8b69a7488 100644 --- a/test/unit/obj/test_reconstructor.py +++ b/test/unit/obj/test_reconstructor.py @@ -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):