Re: no standard way of using formats across manager

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

 



On Wednesday, November 27, 2024 6:48:03 AM EST Neeraj Pratap Singh wrote:
> Hey everyone,
> 
> Recently, we came across a ticket which mentions about xml format not
> working properly for some of ceph commands.
> 
> After looking into the code, I found that we are not following any standard
> to use the formats for the ceph commands across manager modules, and
> especially xml format is highly ignored. Though xml and xml-pretty is being
> accepted by 'src/ceph.in' , the ceph's command management tool.
> 
> Apart from this, each and every module have their own way of using the
> formats, some have hardcoded for json, plain etc. and rest in other way.
> 
> I too encountered a file named `object_format.py` which resides in
> `src/pybind/mgr/` but this also had been used by a few modules (mgr/nfs).
> 
> Thoughts?


Hi Neeraj, you're right that every ceph mgr module can do things independently 
with the format value. The C++ mgr modules might be a tad bit more consistent 
with XML handling but I don't know for sure. Certainly, many of the python 
modules are probably not handling xml at all.  The `ceph` command line tool 
can send various format strings to the mgr module backend but the backend is 
free to ignore them.

The object_format.py code is currently in use by the nfs module and the smb 
module (in main). We have had discussions of moving the cephadm module to use 
it with some frequency but we have not done so yet.  I'd love to see more 
modules adapt the object formatter approach. It is designed to try and 
separate concerns so that most python code in the mgr can be written in a 
typical python style and only a very limited set of functions (typically in 
the module class) need to be aware it's part of the mgr.  However, I have not 
had the time or energy to convert "random" mgr module so it's up to the mgr 
module maintainers to adopt the object formatter style if desired.
(Also, I'm sure there are cases it doesn't cover - I am happy to discuss 
design tweaks and features if you'd like to use it but it's not covering your 
use cases)

What are you looking at in terms of XML support? With XML vs JSON/YAML it's 
much more typical to have a pre-defined xml schema versus the free use of lists 
and maps. Therefore most of our objects can be automatically mapped to JSON/
YAML without much additional work.
We could come up with our own schema or adopt something out there... or we 
could create some sort of JSON-but-in-XML, but I am unclear how much value 
that would  be.
I'm also curious if the existing JSON/YAML support is not covering a use case 
you have?

This is a topic I'm very interested in - even though I have not had much time 
to work on it lately! :-)




_______________________________________________
Dev mailing list -- dev@xxxxxxx
To unsubscribe send an email to dev-leave@xxxxxxx




[Index of Archives]     [CEPH Users]     [Ceph Devel]     [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