Change in vdsm[master]: vdscli: add a timeout option for plaintext connections
ykaplan at redhat.com
ykaplan at redhat.com
Thu Mar 19 14:55:52 UTC 2015
Yeela Kaplan has uploaded a new change for review.
Change subject: vdscli: add a timeout option for plaintext connections
......................................................................
vdscli: add a timeout option for plaintext connections
Change-Id: I38ebcb5bfb8fe93a04b8693cfcc17a6c0f6785ce
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M lib/vdsm/vdscli.py
1 file changed, 10 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/38947/1
diff --git a/lib/vdsm/vdscli.py b/lib/vdsm/vdscli.py
index 8339766..d40b8c0 100644
--- a/lib/vdsm/vdscli.py
+++ b/lib/vdsm/vdscli.py
@@ -53,10 +53,17 @@
connection. This class reverts the change to avoid the concurrency
issues.'''
+ def __init__(self, timeout=sslutils.SOCKET_DEFAULT_TIMEOUT):
+ xmlrpclib.Transport.__init__(self)
+ self.timeout = timeout
+
def make_connection(self, host):
'''Creates a new HTTPConnection to the host.'''
+
self._connection = None
- return xmlrpclib.Transport.make_connection(self, host)
+ httpCon = xmlrpclib.Transport.make_connection(self, host)
+ httpCon._conn.timeout = self.timeout
+ return httpCon
def __guessDefaults():
@@ -116,11 +123,8 @@
server = xmlrpclib.ServerProxy('https://%s' % hostPort,
wrap_transport(transport))
else:
- # TODO: add timeout option for HTTP connection
- if timeout is not sslutils.SOCKET_DEFAULT_TIMEOUT:
- raise NotImplementedError('timeout is not supported in'
- ' plaintext connection')
- transport = wrap_transport(SingleRequestTransport())
+ transport = wrap_transport(
+ SingleRequestTransport(timeout=timeout))
server = xmlrpclib.Server('http://%s' % hostPort, transport)
return server
--
To view, visit https://gerrit.ovirt.org/38947
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38ebcb5bfb8fe93a04b8693cfcc17a6c0f6785ce
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>
More information about the vdsm-patches
mailing list