Yeela Kaplan has uploaded a new change for review.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
jsonrpc cli: allow client to return compatible results
to xmlrpc.
Bridge transforms the return value for different verbs results returning from vdsm API. Some code expects the old return results of API compatible with xmlrpc.
The compat parameter allows us to return a value that is compatible with the way xmlrpc is parsed and we'll be able to remove this once we stop supporting xmlrpc API.
Until then using this intermediate step is the most straight-forward way and saves us the unnecessary hassle of re-translating the bridge work once its done parsing the result from API.
Change-Id: Id0bbbb46f622e60824cf5d25670fd16889f4fc51 Signed-off-by: Yeela Kaplan ykaplan@redhat.com --- M lib/vdsm/jsonrpcvdscli.py M lib/vdsm/response.py 2 files changed, 22 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/47923/1
diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py index c5a4df9..4fb197d 100644 --- a/lib/vdsm/jsonrpcvdscli.py +++ b/lib/vdsm/jsonrpcvdscli.py @@ -46,9 +46,10 @@
class _Server(object):
- def __init__(self, client): + def __init__(self, client, compat): self._vdsmapi = vdsmapi.get_api() self._client = client + self._compat = compat
def _prepare_args(self, className, methodName, args, kwargs): sym = self._vdsmapi['commands'][className][methodName] @@ -82,6 +83,9 @@ if resp.error is not None: return response.error_raw(resp.error["code"], resp.error["message"]) + + if not self._compat: + return response.success_raw(resp.result)
if resp.result and resp.result is not True: # None is translated to True inside our JSONRPC implementation @@ -126,7 +130,7 @@ def connect(requestQueue, stompClient=None, host=None, port=None, useSSL=None, - responseQueue=None): + responseQueue=None, compat=True): if not stompClient: client = _create(requestQueue, host, port, useSSL, @@ -138,4 +142,4 @@ str(uuid4()) )
- return _Server(client) + return _Server(client, compat) diff --git a/lib/vdsm/response.py b/lib/vdsm/response.py index 62ed49e..160898f 100644 --- a/lib/vdsm/response.py +++ b/lib/vdsm/response.py @@ -41,6 +41,21 @@ return kwargs
+def success_raw(result=None, message=None): + ret = { + 'status': + { + "code": doneCode["code"], + "message": message or doneCode["message"], + } + } + + if result: + ret['result'] = result + + return ret + + def error(name, message=None): status = errCode[name]["status"] return {
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Yaniv Bronhaim has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
Patch Set 2: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/47923/2//COMMIT_MSG Commit Message:
Line 13: Line 14: The compat parameter allows us to return a value Line 15: that is compatible with the way xmlrpc is parsed Line 16: and we'll be able to remove this once we stop Line 17: supporting xmlrpc API. so please call the new parameter - xml_compatible=True\False and add a comment in code "# REQUIRED_FOR:" with explanation Line 18: Line 19: Until then using this intermediate step is the most Line 20: straight-forward way and saves us the unnecessary Line 21: hassle of re-translating the bridge work
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Yaniv Bronhaim has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 3: Code-Review+1
Yeela Kaplan has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 3: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 3: Code-Review+2
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc. ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
Patch Set 6:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Piotr Kliczewski has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
Patch Set 6: Code-Review+1
Dan Kenigsberg has submitted this change and it was merged.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
jsonrpc cli: allow client to return compatible results to xmlrpc
Bridge transforms the return value for different verbs results returning from vdsm API. Some code expects the old return results of API compatible with xmlrpc.
The compat parameter allows us to return a value that is compatible with the way xmlrpc is parsed and we'll be able to remove this once we stop supporting xmlrpc API.
Until then using this intermediate step is the most straight-forward way and saves us the unnecessary hassle of re-translating the bridge work once its done parsing the result from API.
Change-Id: Id0bbbb46f622e60824cf5d25670fd16889f4fc51 Signed-off-by: Yeela Kaplan ykaplan@redhat.com Reviewed-on: https://gerrit.ovirt.org/47923 Reviewed-by: Yaniv Bronhaim ybronhei@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com Continuous-Integration: Jenkins CI Reviewed-by: Piotr Kliczewski piotr.kliczewski@gmail.com --- M lib/vdsm/jsonrpcvdscli.py M lib/vdsm/response.py 2 files changed, 22 insertions(+), 3 deletions(-)
Approvals: Piotr Kliczewski: Looks good to me, but someone else must approve Yeela Kaplan: Verified Yaniv Bronhaim: Looks good to me, but someone else must approve Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: jsonrpc cli: allow client to return compatible results to xmlrpc ......................................................................
Patch Set 7:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org