On 1/12/20 5:48 AM, rima.khoury(a)nokia.com wrote:
Hello,
according to the ceph documentation, when implementing a new ceph plugin there are three
functions that are important to override:
as shown in the documentation:
"
The most important methods to override are:
a serve member function for server-type modules. This function should block forever.
a notify member function if your module needs to take action when new cluster data is
available.
a handle_command member function if your module exposes CLI commands.
"
It is not very clear to me what is the difference between the serve method and the
handle_command. when do I use one or another? can someone please explain this a little
further
handle_command must return, with specific return values, once the
command is handled (this might be used to return information to the
user, for example).
serve runs for whole time the module runs, and should block when it has
no work to do, just like a normal "service". It might wake up for
notifications delivered via notify(), for example, or perhaps periodically.
Not every module needs both serve() and handle_command(); it depends on
what you're trying to accomplish. Look at the existing modules to get
an idea of what both functions do and what they must pay attention to,
if implemented.