[ClusterLabs Developers] SDK/API's for Pacemaker/Corosync

Jan Friesse jfriesse at redhat.com
Tue Feb 5 07:23:34 UTC 2019


Ken Gaillot napsal(a):
> On Mon, 2019-02-04 at 09:11 -0800, Vinod Chegu wrote:
>>
>> Hi Ken
>>
>> Thanks for your response and pointers !
>>
>> What you suggest is certainly one option.
>>
>> If there are any examples of using the C API's please point me to the
>> same. 'am trying to search for them too.
> 
> Speaking only of the pacemaker C API, it's pretty low-level and
> unlikely to have anything of interest. The (meager) documentation for
> it is here:
> 
> http://clusterlabs.org/pacemaker/doxygen/
> 
> There aren't any examples per se, but you can look at the various
> pacemaker command-line tools:
> 
> https://github.com/ClusterLabs/pacemaker/tree/master/tools
> 
> 

Let me add the Corosync one with same comment as Ken had: very low-level 
and super unlikely to have anything of interest. All documentation is in 
man pages - cpg_* (start with cpg_overview.3), quorum_* 
(quorum_overview.3), cmap_* (cmap_overview.3), ...

Some examples are in test directory 
(https://github.com/corosync/corosync/tree/master/test) - but there is 
nothing like tutorial.

Another inspiration may be tools directory 
(https://github.com/corosync/corosync/tree/master/tools), or any project 
which uses corosync (so qdevice, pacemaker, asterisk)


>>
>> Thanks!
>> Vinod
>>
>> On Mon, Feb 4, 2019 at 8:57 AM Ken Gaillot <kgaillot at redhat.com>
>> wrote:
>>> On Sun, 2019-02-03 at 08:44 -0800, Vinod Chegu wrote:
>>>> Hello,
>>>>
>>>> 'am new to this forum and am looking for some pointers.
>>>>
>>>> Are there any Python based examples (in some github repo etc)
>>> that
>>>> show the usage of Pacemaker/Corosync APIs for creation and
>>> management
>>>> (add/delete/list/[un]maintenance, monitor alerts) of cluster of
>>> Linux
>>>> nodes?
>>>>
>>>> Thanks !
>>>> VC
>>>
>>> Hi Vinod,
>>>
>>> There is currently no Python API, though that is on the long-term
>>> wish
>>> list.
>>>
>>> Corosync and Pacemaker each have C APIs, but those are likely much
>>> lower level than you're interested in. For cluster creation etc.,
>>> the
>>> command-line tools are the primary way to interact with the
>>> cluster, so
>>> using those with subprocess.call() would be one way to go.
>>>
>>> The higher-level tools crm shell and pcs provide an easier
>>> interface to
>>> both corosync and pacemaker, so you may want to pick one of them
>>> instead, at the cost of creating an additional dependency for your
>>> tool.
>>>
>>> For alerts, you can have pacemaker call a Python script with
>>> interesting info passed as environment variables. See:
>>>
>>>
> http://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html-single/Pacemaker_Explained/index.html#idm140330787858944
>>> _______________________________________________
>>> Developers mailing list
>>> Developers at clusterlabs.org
>>> https://lists.clusterlabs.org/mailman/listinfo/developers



More information about the Developers mailing list