[Pacemaker] python bindings

Yan Gao ygao at novell.com
Wed Jul 8 04:59:33 UTC 2009


Hi,
On Tue, 2009-07-07 at 18:28 +0200, Dejan Muhamedagic wrote:
> Hi,
> 
> On Tue, Jul 07, 2009 at 02:39:31PM +0200, Nikola Ciprich wrote:
> > Hello,
> > I would like to do some extensive scripting with python and pacemaker. 
> > According to what I've discovered so far, it seems that there are at least
> > two implemented python "bindings" - one in Dejan's crm shell and one in
> > Yan's mgmt package. I'm wandering if it maybe might make sense to start
> > project on creating separate set of python bindings which could be usable
> > by both those projects as well as others.
> 
> That would be great, of course. I talked to Yan about it a bit,
> but we didn't get further than agreeing that it would be of
> benefit to have common python library (or bindings, as you put
> it).
Yes, we do believe we could find something that could be reused, even
the two tools have different mechanisms

> 
> The GUI is quite a bit older than the crm shell and it supports
> the older Heartbeat v2 CIB format. 
The GUI now supports any format of CIB. Since it queries the CIB and
determines the version of it, then retrieves the corresponding version
of Relax-NG/DTD schema from the back-end, and renders the UI according
to the schema.

> Though there was a lot of new
> development in the GUI as well. Now, the two have different
> access patterns: the crm talks to the cib (the daemon) using
> cibadmin whereas the GUI accesses the CIB over the network
> through mgmtd. 
Yes, the GUI was designed to be assumed to run remotely.

> I don't know the protocol details.
Basically, after the front-end renders the UI according to the
corresponding schema and the current CIB XML, users can do any
modification on it. Then the front-end will process the new XML and do
validating. If the new XML is valid, the front-end will transfer the XML
to the back-end (mgmtd), and mgmtd will update it to cib.

>  BTW, the cib
> also has network capabilities, so it's possible to use the crm
> shell or cibadmin or crm_resource from a remote host (but I never
> tried that).
Interesting:-)

> 
> > In such case, what would be the best way of creating those bindings? 
> 
> I guess first by identifying the needs, then to devise the
> interface, finally to analyze the existing code and see how the
> interface fits, then to redesign interface :)
> 
> > I'm considering either reusing the existing code (either from crm, or mgmt)
> > or creating it from scratch...
> 
> Probably some parts can be reused.
Indeed

> 
> > And is it better to use mgmt interface, or rather parse commands output? (I 
> > don'r really like the latter variant)
> 
> The mgmtd should sometimes in future be converted to use the crm
> shell interface. 
Or at least supports crm shell syntax I think:-)

> When you say "parse output" to which output do
> you refer?
> 
> > Anyways, any suggestion would be appreciated!
> 
> Not a python expert here, so I'm all ears to hear about possible
> improvements.
Me either:-)
Thanks!

-- 
Regards,
Yan Gao
China R&D Software Engineer
ygao at novell.com

Novell, Inc.
Making IT Work As One™





More information about the Pacemaker mailing list