Change in vdsm[master]: jsonrpc cli: Allow setting timeout for long operations

ykaplan at redhat.com ykaplan at redhat.com
Sun Nov 1 08:44:10 UTC 2015


Yeela Kaplan has uploaded a new change for review.

Change subject: jsonrpc cli: Allow setting timeout for long operations
......................................................................

jsonrpc cli: Allow setting timeout for long operations

Current timeout for operations over jsonrpc is 15
seconds.
Some operations are slower and require
more time.
We want to allow those to set a timeout separately.
If no new timeout is supplied we use the default
jsonrpc timeout.

Change-Id: Ib71a5d58a9b6ba141492b2bcec5aebd5d6249179
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M lib/vdsm/jsonrpcvdscli.py
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/47922/1

diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py
index 7d35d62..c5a4df9 100644
--- a/lib/vdsm/jsonrpcvdscli.py
+++ b/lib/vdsm/jsonrpcvdscli.py
@@ -27,7 +27,8 @@
 from yajsonrpc import stompreactor
 from yajsonrpc import \
     JsonRpcRequest, \
-    JsonRpcNoResponseError
+    JsonRpcNoResponseError, \
+    CALL_TIMEOUT
 
 from api import vdsmapi
 from vdsm import response
@@ -68,8 +69,11 @@
         class_name, method_name = method.split('.')
         params = self._prepare_args(class_name, method_name, args, kwargs)
 
+        timeout = kwargs.pop('longOp', CALL_TIMEOUT)
+
         req = JsonRpcRequest(method, params, reqId=str(uuid4()))
-        responses = self._client.call(req)
+
+        responses = self._client.call(req, timeout=timeout)
         if responses:
             resp = responses[0]
         else:


-- 
To view, visit https://gerrit.ovirt.org/47922
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib71a5d58a9b6ba141492b2bcec5aebd5d6249179
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