[ovirt-devel] [VDSM][JSON RPC] new vdsClient?

Nir Soffer nsoffer at redhat.com
Fri Nov 14 21:24:17 UTC 2014


----- Original Message -----
> From: "Piotr Kliczewski" <piotr.kliczewski at gmail.com>
> To: "Nir Soffer" <nsoffer at redhat.com>
> Cc: "Francesco Romani" <fromani at redhat.com>, devel at ovirt.org
> Sent: Friday, 14 November, 2014 9:44:50 PM
> Subject: Re: [ovirt-devel] [VDSM][JSON RPC] new vdsClient?
> 
> On Fri, Nov 14, 2014 at 5:52 PM, Nir Soffer <nsoffer at redhat.com> wrote:
> > ----- Original Message -----
> >> From: "Francesco Romani" <fromani at redhat.com>
> >> To: devel at ovirt.org
> >> Sent: Friday, 14 November, 2014 6:34:57 PM
> >> Subject: [ovirt-devel] [VDSM][JSON RPC] new vdsClient?
> >>
> >> 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.
> >
> 
> I started discussion about it and here is what I was able to gather:
> - we should start new vdsClient like tool which holds current vdsClient
>   command line interface.
> - vdsClient should stay as it is and we can extend new client with additional
>   functionality as we need (adding debug mode etc)

Current vdsClient horrible - we need to replace it with something better.

- The interface is not consistent, trying to convert command line options to 
  xmlrpc call
- Error handling is not helpful, showing an error message and then printing
  help for all verbse, so the error message is hidden above your screen
- Help message is not useful, we need only the names of the parameters
- We need extended help for specific verb - like "git help commit"
- Command output is not consistent and unusable for parsing in scripts
  We need to print the returned value from vdsm as is, or prety printed.

> - there was a suggestion to reuse ovirt-engine-cli ideas and it should
> use schema
>   to determine the API

Using the schema can be nice to generate help for the commands.

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
          }
      ]
  }

Nir



More information about the Devel mailing list