Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to use IPMI to set machines to PXE boot (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis bootdev pxe) and then power cycle them (i.e. ipmitool -I lan -U username -P password -H ipaddress chassis power cycle). However, I'd like to do this in a python script so I'm trying to use OpenIPMI and its python bindings.

I can't seem to find any documentation on OpenIPMI for a python script and I'm not sure how to correctly apply IPMI commands (making sure the machine is in the right state so the commands don't fail). Can someone please show me some pointers or resources on using OpenIPMI (or an alternative) to operate IPMI commands in python? Thanks!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

So while you're trying to figure out the IPMI bindings, why not write simple wrappers for the commandline ipmitool? Later you can figure out how to get the python bindings to work right and sub them in; for now, use subprocess.Popen() and friends.

share|improve this answer
    
I did just that and it seems to work for the moment, but I'm not sure how to tell if a subprocess.Popen() failed. –  William Jul 1 '10 at 19:01
    
Use subprocess.check_call(). Or look at the return_code attribute on your subprocess.Popen object after it's finished (use .communicate() or .wait() to make sure it's finished.) –  Greg Price Jul 1 '10 at 19:07

I was going to write a bit about import the OpenIPMI module and then running help() on it, but that's not going to help much :P

The OpenIPMI Python bindings sadly come with virtually no documentation whatsoever. On quick inspection, the only OpenIPMI package on Fedora that has at least some form of documentation is the OpenIPMI package itself, which has some manpages.

The OpenIPMI-devel package doesn't even have documentation. If you find some documentation - and I admittedly haven't really looked anywhere outside of my own system - I'd be interested!

share|improve this answer
    
Thanks for looking. I haven't found anything either other than the OpenIMPI-gui. –  William Jul 1 '10 at 19:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.