add parameter 'connectionPoolTimeout' in both SmartConnect and SmartConnectNoSSL
This commit is contained in:
@@ -192,6 +192,7 @@ class VimSessionOrientedStub(SessionOrientedStub):
|
|||||||
|
|
||||||
def Connect(host='localhost', port=443, user='root', pwd='',
|
def Connect(host='localhost', port=443, user='root', pwd='',
|
||||||
service="hostd", adapter="SOAP", namespace=None, path="/sdk",
|
service="hostd", adapter="SOAP", namespace=None, path="/sdk",
|
||||||
|
connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC,
|
||||||
version=None, keyFile=None, certFile=None, thumbprint=None,
|
version=None, keyFile=None, certFile=None, thumbprint=None,
|
||||||
sslContext=None, b64token=None, mechanism='userpass'):
|
sslContext=None, b64token=None, mechanism='userpass'):
|
||||||
"""
|
"""
|
||||||
@@ -221,6 +222,9 @@ def Connect(host='localhost', port=443, user='root', pwd='',
|
|||||||
@type namespace: string
|
@type namespace: string
|
||||||
@param path: Path
|
@param path: Path
|
||||||
@type path: string
|
@type path: string
|
||||||
|
@param connectionPoolTimeout: Timeout in secs for idle connections to close, specify negative numbers for never
|
||||||
|
closing the connections
|
||||||
|
@type connectionPoolTimeout: int
|
||||||
@param version: Version
|
@param version: Version
|
||||||
@type version: string
|
@type version: string
|
||||||
@param keyFile: ssl key file path
|
@param keyFile: ssl key file path
|
||||||
@@ -334,7 +338,8 @@ def GetLocalTicket(si, user):
|
|||||||
## connected service instance object.
|
## connected service instance object.
|
||||||
|
|
||||||
def __Login(host, port, user, pwd, service, adapter, version, path,
|
def __Login(host, port, user, pwd, service, adapter, version, path,
|
||||||
keyFile, certFile, thumbprint, sslContext):
|
keyFile, certFile, thumbprint, sslContext,
|
||||||
|
connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC):
|
||||||
"""
|
"""
|
||||||
Private method that performs the actual Connect and returns a
|
Private method that performs the actual Connect and returns a
|
||||||
connected service instance object.
|
connected service instance object.
|
||||||
@@ -364,6 +369,9 @@ def __Login(host, port, user, pwd, service, adapter, version, path,
|
|||||||
@param sslContext: SSL Context describing the various SSL options. It is only
|
@param sslContext: SSL Context describing the various SSL options. It is only
|
||||||
supported in Python 2.7.9 or higher.
|
supported in Python 2.7.9 or higher.
|
||||||
@type sslContext: SSL.Context
|
@type sslContext: SSL.Context
|
||||||
|
@param connectionPoolTimeout: Timeout in secs for idle connections to close, specify negative numbers for never
|
||||||
|
closing the connections
|
||||||
|
@type connectionPoolTimeout: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
content, si, stub = __RetrieveContent(host, port, adapter, version, path,
|
content, si, stub = __RetrieveContent(host, port, adapter, version, path,
|
||||||
@@ -391,7 +399,8 @@ def __Login(host, port, user, pwd, service, adapter, version, path,
|
|||||||
## Copyright (c) 2015 Morgan Stanley. All rights reserved.
|
## Copyright (c) 2015 Morgan Stanley. All rights reserved.
|
||||||
|
|
||||||
def __LoginBySSPI(host, port, service, adapter, version, path,
|
def __LoginBySSPI(host, port, service, adapter, version, path,
|
||||||
keyFile, certFile, thumbprint, sslContext, b64token):
|
keyFile, certFile, thumbprint, sslContext, b64token,
|
||||||
|
connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC):
|
||||||
"""
|
"""
|
||||||
Private method that performs the actual Connect and returns a
|
Private method that performs the actual Connect and returns a
|
||||||
connected service instance object.
|
connected service instance object.
|
||||||
@@ -419,6 +428,9 @@ def __LoginBySSPI(host, port, service, adapter, version, path,
|
|||||||
@type sslContext: SSL.Context
|
@type sslContext: SSL.Context
|
||||||
@param b64token: base64 encoded token
|
@param b64token: base64 encoded token
|
||||||
@type b64token: string
|
@type b64token: string
|
||||||
|
@param connectionPoolTimeout: Timeout in secs for idle connections to close, specify negative numbers for never
|
||||||
|
closing the connections
|
||||||
|
@type connectionPoolTimeout: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
content, si, stub = __RetrieveContent(host, port, adapter, version, path,
|
content, si, stub = __RetrieveContent(host, port, adapter, version, path,
|
||||||
@@ -453,7 +465,7 @@ def __Logout(si):
|
|||||||
## Private method that returns the service content
|
## Private method that returns the service content
|
||||||
|
|
||||||
def __RetrieveContent(host, port, adapter, version, path, keyFile, certFile,
|
def __RetrieveContent(host, port, adapter, version, path, keyFile, certFile,
|
||||||
thumbprint, sslContext):
|
thumbprint, sslContext, connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC):
|
||||||
"""
|
"""
|
||||||
Retrieve service instance for connection.
|
Retrieve service instance for connection.
|
||||||
@param host: Which host to connect to.
|
@param host: Which host to connect to.
|
||||||
@@ -470,6 +482,9 @@ def __RetrieveContent(host, port, adapter, version, path, keyFile, certFile,
|
|||||||
@type keyFile: string
|
@type keyFile: string
|
||||||
@param certFile: ssl cert file path
|
@param certFile: ssl cert file path
|
||||||
@type certFile: string
|
@type certFile: string
|
||||||
|
@param connectionPoolTimeout: Timeout in secs for idle connections to close, specify negative numbers for never
|
||||||
|
closing the connections
|
||||||
|
@type connectionPoolTimeout: int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# XXX remove the adapter and service arguments once dependent code is fixed
|
# XXX remove the adapter and service arguments once dependent code is fixed
|
||||||
@@ -479,7 +494,8 @@ def __RetrieveContent(host, port, adapter, version, path, keyFile, certFile,
|
|||||||
# Create the SOAP stub adapter
|
# Create the SOAP stub adapter
|
||||||
stub = SoapStubAdapter(host, port, version=version, path=path,
|
stub = SoapStubAdapter(host, port, version=version, path=path,
|
||||||
certKeyFile=keyFile, certFile=certFile,
|
certKeyFile=keyFile, certFile=certFile,
|
||||||
thumbprint=thumbprint, sslContext=sslContext)
|
thumbprint=thumbprint, sslContext=sslContext,
|
||||||
|
connectionPoolTimeout=connectionPoolTimeout)
|
||||||
|
|
||||||
# Get Service instance
|
# Get Service instance
|
||||||
si = vim.ServiceInstance("ServiceInstance", stub)
|
si = vim.ServiceInstance("ServiceInstance", stub)
|
||||||
@@ -758,7 +774,7 @@ def SmartStubAdapter(host='localhost', port=443, path='/sdk',
|
|||||||
samlToken=samlToken, sslContext=sslContext)
|
samlToken=samlToken, sslContext=sslContext)
|
||||||
|
|
||||||
def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd='',
|
def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd='',
|
||||||
service="hostd", path="/sdk",
|
service="hostd", path="/sdk", connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC,
|
||||||
preferredApiVersions=None, keyFile=None, certFile=None,
|
preferredApiVersions=None, keyFile=None, certFile=None,
|
||||||
thumbprint=None, sslContext=None, b64token=None, mechanism='userpass'):
|
thumbprint=None, sslContext=None, b64token=None, mechanism='userpass'):
|
||||||
"""
|
"""
|
||||||
@@ -787,6 +803,9 @@ def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd=
|
|||||||
@type service: string
|
@type service: string
|
||||||
@param path: Path
|
@param path: Path
|
||||||
@type path: string
|
@type path: string
|
||||||
|
@param connectionPoolTimeout: Timeout in secs for idle connections to close, specify negative numbers for never
|
||||||
|
closing the connections
|
||||||
|
@type connectionPoolTimeout: int
|
||||||
@param preferredApiVersions: Acceptable API version(s) (e.g. vim.version.version3)
|
@param preferredApiVersions: Acceptable API version(s) (e.g. vim.version.version3)
|
||||||
If a list of versions is specified the versions should
|
If a list of versions is specified the versions should
|
||||||
be ordered from most to least preferred. If None is
|
be ordered from most to least preferred. If None is
|
||||||
@@ -828,6 +847,7 @@ def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd=
|
|||||||
adapter='SOAP',
|
adapter='SOAP',
|
||||||
version=supportedVersion,
|
version=supportedVersion,
|
||||||
path=path,
|
path=path,
|
||||||
|
connectionPoolTimeout=connectionPoolTimeout,
|
||||||
keyFile=keyFile,
|
keyFile=keyFile,
|
||||||
certFile=certFile,
|
certFile=certFile,
|
||||||
thumbprint=thumbprint,
|
thumbprint=thumbprint,
|
||||||
@@ -836,7 +856,7 @@ def SmartConnect(protocol='https', host='localhost', port=443, user='root', pwd=
|
|||||||
mechanism=mechanism)
|
mechanism=mechanism)
|
||||||
|
|
||||||
def SmartConnectNoSSL(protocol='https', host='localhost', port=443, user='root', pwd='',
|
def SmartConnectNoSSL(protocol='https', host='localhost', port=443, user='root', pwd='',
|
||||||
service="hostd", path="/sdk",
|
service="hostd", path="/sdk", connectionPoolTimeout=CONNECTION_POOL_IDLE_TIMEOUT_SEC,
|
||||||
preferredApiVersions=None, keyFile=None, certFile=None,
|
preferredApiVersions=None, keyFile=None, certFile=None,
|
||||||
thumbprint=None, b64token=None, mechanism='userpass'):
|
thumbprint=None, b64token=None, mechanism='userpass'):
|
||||||
"""
|
"""
|
||||||
@@ -858,6 +878,7 @@ def SmartConnectNoSSL(protocol='https', host='localhost', port=443, user='root',
|
|||||||
pwd=pwd,
|
pwd=pwd,
|
||||||
service=service,
|
service=service,
|
||||||
path=path,
|
path=path,
|
||||||
|
connectionPoolTimeout=connectionPoolTimeout,
|
||||||
preferredApiVersions=preferredApiVersions,
|
preferredApiVersions=preferredApiVersions,
|
||||||
keyFile=keyFile,
|
keyFile=keyFile,
|
||||||
certFile=certFile,
|
certFile=certFile,
|
||||||
|
Reference in New Issue
Block a user