Add configurable http_timeout parameter for Cisco N1K

http_timeout is a constant defined in the code. This
change makes it configurable by providing it as an
option in the config file.

DocImpact

Closes-Bug: #1332290
Change-Id: I429dd9efa43f6a596933359f4627a7761411e621
This commit is contained in:
Sayaji 2014-06-25 11:39:40 -07:00 committed by mark mcclain
parent f1f841d772
commit 479a056f0d
4 changed files with 8 additions and 2 deletions

View File

@ -136,3 +136,8 @@
# (IntOpt) Number of threads to use to make HTTP requests to the VSM. # (IntOpt) Number of threads to use to make HTTP requests to the VSM.
# #
# http_pool_size = 4 # http_pool_size = 4
# (IntOpt) Timeout duration in seconds for the http request
#
# http_timeout =
# Example: http_timeout = 15

View File

@ -81,7 +81,6 @@ NETWORK_SUBTYPE_TRUNK_VXLAN = NETWORK_TYPE_OVERLAY
# Prefix for VM Network name # Prefix for VM Network name
VM_NETWORK_NAME_PREFIX = 'vmn_' VM_NETWORK_NAME_PREFIX = 'vmn_'
DEFAULT_HTTP_TIMEOUT = 15
SET = 'set' SET = 'set'
INSTANCE = 'instance' INSTANCE = 'instance'
PROPERTIES = 'properties' PROPERTIES = 'properties'

View File

@ -80,6 +80,8 @@ cisco_n1k_opts = [
help=_("N1K Policy profile polling duration in seconds")), help=_("N1K Policy profile polling duration in seconds")),
cfg.IntOpt('http_pool_size', default=4, cfg.IntOpt('http_pool_size', default=4,
help=_("Number of threads to use to make HTTP requests")), help=_("Number of threads to use to make HTTP requests")),
cfg.IntOpt('http_timeout', default=15,
help=_("N1K http timeout duration in seconds")),
] ]
cfg.CONF.register_opts(cisco_opts, "CISCO") cfg.CONF.register_opts(cisco_opts, "CISCO")

View File

@ -129,7 +129,7 @@ class Client(object):
self.format = 'json' self.format = 'json'
self.hosts = self._get_vsm_hosts() self.hosts = self._get_vsm_hosts()
self.action_prefix = 'http://%s/api/n1k' % self.hosts[0] self.action_prefix = 'http://%s/api/n1k' % self.hosts[0]
self.timeout = c_const.DEFAULT_HTTP_TIMEOUT self.timeout = c_conf.CISCO_N1K.http_timeout
def list_port_profiles(self): def list_port_profiles(self):
""" """