Merge "NSX|V add more details to vcns debug logs"

This commit is contained in:
Zuul 2017-10-19 08:31:43 +00:00 committed by Gerrit Code Review
commit bcfee7c122

View File

@ -87,6 +87,7 @@ NETWORK_TYPES = ['Network', 'VirtualWire', 'DistributedVirtualPortgroup']
# Dynamic routing constants # Dynamic routing constants
ROUTING_CONFIG = "routing/config" ROUTING_CONFIG = "routing/config"
BGP_ROUTING_CONFIG = "routing/config/bgp" BGP_ROUTING_CONFIG = "routing/config/bgp"
ELAPSED_TIME_THRESHOLD = 30
def retry_upon_exception_exclude_error_codes( def retry_upon_exception_exclude_error_codes(
@ -143,10 +144,18 @@ class Vcns(object):
header, content = self._client_request(_client, method, uri, params, header, content = self._client_request(_client, method, uri, params,
headers, encodeParams) headers, encodeParams)
te = time.time() te = time.time()
elapsed_time = te - ts
LOG.debug('VcnsApiHelper for %(method)s %(uri)s took %(seconds)2.4f. '
'reply: header=%(header)s content=%(content)s',
{'method': method, 'uri': uri,
'header': header, 'content': content,
'seconds': elapsed_time})
if elapsed_time > ELAPSED_TIME_THRESHOLD:
LOG.warning('Vcns call for %(method)s %(uri)s took %(seconds)2.4f',
{'method': method, 'uri': uri,
'seconds': elapsed_time})
LOG.debug('VcnsApiHelper reply: header=%(header)s content=%(content)s'
' took %(seconds)2.4f',
{'header': header, 'content': content, 'seconds': te - ts})
if content == '': if content == '':
return header, {} return header, {}
if kwargs.get('decode', True): if kwargs.get('decode', True):