Re: Getting the JSON schema of commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Erwan,

just my 2 cents on this.

With openATTIC, we had a very similar issue: Constant changes of the
ceph JSON output: The mon command API returns internal data structures
that are subject to change at any time. Also as you said, the structure
is not easily consumable.

Compared to openATTIC, the dashboard has three mitigations for this problem:

1. By living inside the Ceph repo, we no longer need to stay compatible
to previous Ceph versions. Greatly reducing the complexity in some parts.

2. Because the internal data structures are not easy to consume, The
dashboard exposes a consumable REST API to the dashboard frontend that
tries not to expose implementation details. The restful module has a
similar goal.

3. We're verifying the JSON structure in a Teuthology tests. For example:

> https://github.com/ceph/ceph/blob/60d4fa608ea54ea811137d95a073255c728e274c/qa/tasks/mgr/dashboard/test_rbd.py#L183-L204
> https://github.com/ceph/ceph/blob/60d4fa608ea54ea811137d95a073255c728e274c/qa/tasks/mgr/dashboard/test_rgw.py#L151-L161

Hopefully, all unexpected changes will be caught here.

Have you thought about using either restful or the dashboard API for
your tool?

Best,
Sebastian




Am 07.11.18 um 16:10 schrieb Erwan Velu:
> Hi list,
> 
> I'm working on a tool that reads the json output of several ceph commands.
> 
> To ease the parsing, I've been choosing the JSON format which guarantee
> a parseable output.
> 
> I'm using the Unmarshall feature of golang to map this output in an
> internal data structure so every member of this JSON output is easily
> reachable from the code.
> 
> That works pretty well except that I have to "anticipate" what will the
> be members and their types.
> 
> To do that, I've been transforming the sample output of my Ceph cluster
> (luminous) into a data struct with https://mholt.github.io/json-to-go/
> 
> That works fine unless that I would be a complete output to get every
> possible combination of the json output.
> 
> 
> So instead of reversing the json output, and that per version of Ceph as
> versions can change the format, how can I extract the complete JSON
> schema from each command ?
> 
> 
> Erwan,
> 
> 



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux