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

Ken Gaillot kgaillot at redhat.com
Mon Feb 4 16:57:22 UTC 2019


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
-- 
Ken Gaillot <kgaillot at redhat.com>




More information about the Developers mailing list