Merge "[NetApp] Fix lack of retry HTTP requests"
This commit is contained in:
commit
c0103ad501
|
@ -25,7 +25,9 @@ from lxml import etree
|
|||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
import requests
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests import auth
|
||||
from requests.packages.urllib3.util.retry import Retry
|
||||
|
||||
from manila import exception
|
||||
from manila.i18n import _
|
||||
|
@ -227,6 +229,11 @@ class BaseClient(object):
|
|||
auth_handler = self._create_certificate_auth_handler()
|
||||
|
||||
self._session = requests.Session()
|
||||
|
||||
max_retries = Retry(total=5, connect=5, read=2, backoff_factor=1)
|
||||
adapter = HTTPAdapter(max_retries=max_retries)
|
||||
self._session.mount('%s://' % self._protocol, adapter)
|
||||
|
||||
self._session.auth = auth_handler
|
||||
self._session.verify = self._ssl_verify
|
||||
headers = self._build_headers()
|
||||
|
@ -329,6 +336,8 @@ class ZapiClient(BaseClient):
|
|||
self._build_session()
|
||||
try:
|
||||
if hasattr(self, '_timeout'):
|
||||
if self._timeout is None:
|
||||
self._timeout = 10
|
||||
response = self._session.post(
|
||||
self._get_url(), data=request_d, timeout=self._timeout)
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Sometimes NetApp API call fails due to name resolution(DNS) issue. In
|
||||
such case, a client will now make 5 retries on connect and 2 on read
|
||||
calls. Also, the connection retry will be visible in the log. For more
|
||||
details, please refer to
|
||||
`launchpad bug #1971542 <https://bugs.launchpad.net/manila/+bug/1971542>`_
|
Loading…
Reference in New Issue