Add error message and NSX time for failed authentication

In addition to status code, also log error message and
local NSX time for failed NSX authentication for
easier troubleshooting for failed JWT authentication and
potential clock drift between NSX, VC and Master node.

Change-Id: Icf31477bffda85ba73a1123232b6aa5503066922
This commit is contained in:
Xiaotong Luo 2020-09-14 12:26:29 -07:00
parent f54812edf9
commit 5fd0ce5752
1 changed files with 5 additions and 2 deletions

View File

@ -284,8 +284,11 @@ class NSXRequestsHTTPProvider(AbstractHTTPProvider):
else:
if resp.status_code != 200 and resp.status_code != 201:
LOG.warning("Session create failed for endpoint %s with "
"response %s",
provider.url, resp.status_code)
"response %s, error message: %s, "
"local NSX time: %s",
provider.url, resp.status_code,
resp.json().get('error_message'),
resp.headers['Date'])
# this may will later cause the endpoint to be Down
else:
for header_name in resp.headers: