Browse Source

Specify timeout for _get_token REST API request in cert-mon

In a DC env, when management network connectivity is disrupted
for some time, cert-mon's audit greenthreads hang. This
happens because of missing timeouts in REST API requests which
cause the urlopen to remain hanging forever. As a result, the
dc-cert sync status for the subcloud  remains unknown
indefinitely and the subclouds remain out-of-sync.

This commit adds a timeout to the _get_token method to avoid
this issue.

Change-Id: Idd41cfca6b28287de8328b1ace856cc391778cac
Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
Closes-Bug: 1927735
changes/43/790243/3
Jessica Castelino 2 months ago
parent
commit
9e9979d96e
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      sysinv/sysinv/sysinv/sysinv/cert_mon/utils.py

+ 2
- 2
sysinv/sysinv/sysinv/sysinv/cert_mon/utils.py View File

@ -422,7 +422,7 @@ def get_dc_token(region_name):
def _get_token(auth_url, auth_project, username, password, user_domain,
project_domain, region_name):
project_domain, region_name, timeout=60):
"""
Ask OpenStack Keystone for a token
Returns: token object or None on failure
@ -453,7 +453,7 @@ def _get_token(auth_url, auth_project, username, password, user_domain,
request_info.add_data(payload)
request = urlopen(request_info)
request = urlopen(request_info, timeout=timeout)
# Identity API v3 returns token id in X-Subject-Token
# response header.
token_id = request.info().getheader('X-Subject-Token')


Loading…
Cancel
Save