Change in vdsm[master]: jsonrpc: vdscli: migration: fix migrationCreate

fromani at redhat.com fromani at redhat.com
Mon Jun 29 07:35:45 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: jsonrpc: vdscli: migration: fix migrationCreate
......................................................................

jsonrpc: vdscli: migration: fix migrationCreate

In virt migration code, we do logic on the return
value of VM.migrationCreate API, and we expect it
to be a proper response, so with ['status']['code']
field, plus all the extra fields that APIs can add
(see schema for examples).

Current jsonrpc code strips all but the extra fields,
so jsonrpcvdscli has to force fit a success code.

This patch simplify the code by just passing around
a copy of the raw data, leveraging the response module.
This way the code is both simpler and more conformant
to the old XML-RPC vdscli API.

Change-Id: Ie9288d367c519830f6510a2d1b2a5fc1e410949c
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/jsonrpcvdscli.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/42970/1

diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py
index 595c584..8ef1cbf 100644
--- a/lib/vdsm/jsonrpcvdscli.py
+++ b/lib/vdsm/jsonrpcvdscli.py
@@ -26,6 +26,8 @@
     JsonRpcRequest, \
     JsonRpcNoResponseError
 
+from vdsm import response
+
 
 _COMMAND_CONVERTER = {
     'ping': 'Host.ping',
@@ -58,13 +60,12 @@
         if resp.error is not None:
             return resp.error
 
-        return resp.result
+        return response.success(**resp.result)
 
     def migrationCreate(self, params):
-        self._callMethod('migrationCreate',
-                         params['vmId'],
-                         params)
-        return {'status': {'code': 0}}
+        return self._callMethod('migrationCreate',
+                                params['vmId'],
+                                params)
 
     def __getattr__(self, methodName):
         return partial(self._callMethod, methodName)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9288d367c519830f6510a2d1b2a5fc1e410949c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list