Set pool size for HTTPS connections

Setting the pool size was done only for the 'file' protocol which has no
effect when communicating with vCenter over HTTPS. This patch sets the
pool size for HTTPS connections as well.

Change-Id: I1bb72d27a6861b4a2cf327bfd6705d58a31d49c5
Closes-Bug: #1618477
This commit is contained in:
Radoslav Gerganov 2016-08-30 17:16:28 +03:00
parent 6bf58463e0
commit 53c7c370bc
2 changed files with 5 additions and 0 deletions

View File

@ -143,6 +143,8 @@ class RequestsTransport(transport.Transport):
self.session = requests.Session()
self.session.mount('file:///',
LocalFileAdapter(pool_maxsize=pool_maxsize))
self.session.mount('https://', requests.adapters.HTTPAdapter(
pool_connections=pool_maxsize, pool_maxsize=pool_maxsize))
self.cookiejar = self.session.cookies
self._connection_timeout = connection_timeout

View File

@ -445,6 +445,9 @@ class RequestsTransportTest(base.TestCase):
local_file_adapter = transport.session.adapters['file:///']
self.assertEqual(100, local_file_adapter._pool_connections)
self.assertEqual(100, local_file_adapter._pool_maxsize)
https_adapter = transport.session.adapters['https://']
self.assertEqual(100, https_adapter._pool_connections)
self.assertEqual(100, https_adapter._pool_maxsize)
@mock.patch('os.path.getsize')
def test_send_with_local_file_url(self, get_size_mock):