
----- Original Message -----
From: "Dan Kenigsberg" <danken@redhat.com> To: "Nir Soffer" <nsoffer@redhat.com> Cc: "Piotr Kliczewski" <piotr.kliczewski@gmail.com>, devel@ovirt.org Sent: Wednesday, November 19, 2014 7:21:09 PM Subject: Re: [ovirt-devel] [VDSM][JSON RPC] new vdsClient?
On Fri, Nov 14, 2014 at 04:24:17PM -0500, Nir Soffer wrote:
Hi everyone,
the recent JSONRPC discussion and my last work around vdsClient reminded me that since a long time there it was vague plans for a vdsClient overhaul
or at least I haven't ever found a detailed plan :)
Since we have to add jsonrpc support anyway, it could be a good chance to bootstrap a new vdsClient, and incrementally enhance it as needs arises; the old vdsClient will not go away very soon, I guess.
At least, we can to put together a wishlist for a new vdsClient and add it to the wiki.
My one, so far: * client library package: we should have a program-friendly python package to access VDSM, in order * JSON for input: I's like to open logs, grab a line including a command and feed vdsClient with the very same line
Currently we don't see commands json input in the logs, but this can be a good idea (in debug mode).
+1
JSON for output: current vdsClient format replies in a mix of text and json. We need to print the json returned from vdsm as is.
but a pretty-printed output can be useful, too.
Actually it is more useful.
I started a simple jsonrpc client that can be used for testing *now*: http://gerrit.ovirt.org/35181
Example usage:
Calling method without arguements:
# jsonrpc Host.getVMList { "jsonrpc": "2.0", "id": "0e043d83-294a-4d31-b1b6-6dc2f2747494", "result": [ "b3f6fa00-b315-4ad4-8108-f73da817b5c5" ] }
Calling method with arguements:
# jsonrpc VM.getStats '{"vmID": "b3f6fa00-b315-4ad4-8108-f73da817b5c5"}' { "jsonrpc": "2.0", "id": "cefd25a3-6250-4123-8a56-d7047899e19e", "result": [ { "status": "Down", "exitMessage": "Admin shut down from the engine", "vmId": "b3f6fa00-b315-4ad4-8108-f73da817b5c5", "exitReason": 6, "timeOffset": "0", "exitCode": 0 } ] }
Thanks, this looks very nice and ready for contrib, imho.
I'd love to see something similar done to make vdscli connect over jsonrpc. When I need to do something less than trivial from the command line, I start python and
from vdsm import vdscli s = vdscli.connect() # does a horribly useful heuristic, to connect # to local host over xmlrpc
Maybe: s = vdscli.connect("jsonrpc:10.35.0.174:54321")
print s.getVMList()
Nice - but we have mismatch between the API (used by jsonrpc) and xmlrpc verbs.
I'd like to see vdscli.connect() extended to jsonrpc. This would simplify Bug 1112594 - Use jsonrpc during migration of vms too.
Nir