# interface name was not specified
# default_interface_name = breth0
+# Reconnect connection to nsx if not used within this amount of time.
+# conn_idle_timeout = 900
+
[quotas]
# number of network gateways allowed per tenant, -1 means unlimited
# quota_network_gateway = 5
import six
import time
+from oslo.config import cfg
+
from neutron.openstack.common import log as logging
from neutron.plugins.vmware import api_client
class ApiClientBase(object):
"""An abstract baseclass for all API client implementations."""
- CONN_IDLE_TIMEOUT = 60 * 15
-
def _create_connection(self, host, port, is_ssl):
if is_ssl:
return httplib.HTTPSConnection(host, port,
LOG.debug(_("[%d] Waiting to acquire API client connection."), rid)
priority, conn = self._conn_pool.get()
now = time.time()
- if getattr(conn, 'last_used', now) < now - self.CONN_IDLE_TIMEOUT:
+ if getattr(conn, 'last_used', now) < now - cfg.CONF.conn_idle_timeout:
LOG.info(_("[%(rid)d] Connection %(conn)s idle for %(sec)0.2f "
"seconds; reconnecting."),
{'rid': rid, 'conn': api_client.ctrl_conn_to_str(conn),
cfg.ListOpt('nsx_controllers',
deprecated_name='nvp_controllers',
help=_("Lists the NSX controllers in this cluster")),
+ cfg.IntOpt('conn_idle_timeout',
+ default=900,
+ help=_('Reconnect connection to nsx if not used within this '
+ 'amount of time.')),
]
cluster_opts = [
self.assertIsNone(cfg.CONF.default_l3_gw_service_uuid)
self.assertIsNone(cfg.CONF.default_l2_gw_service_uuid)
self.assertEqual('breth0', cfg.CONF.default_interface_name)
+ self.assertEqual(900, cfg.CONF.conn_idle_timeout)
def test_load_api_extensions(self):
self.config_parse(args=['--config-file', BASE_CONF_PATH,