Ok, first of all the syntax of the si_power tool should be the same
regardless of the method used IME.
There should also be a good default that works in most cases (probably the
ssh way).
Maybe the best way would be to create a separate si_power configuration file
that defines the possible power primitives and the methods used to achieve
them. In the cluster.txt we would then only specify the name of the method
to use:
<group>
<name>cluster1</name>
<image>RHEL5</image>
<override>RHEL5</override>
<node>node001-node100</node>
<power-control>wol,ssh</power-control>
</group>
The si_power config file could look like:
<command name="on" defaultMethod="wol">
<method name="wol">wol %h</method>
<method name="ipmi">ipmitool -I lan -A NONE -U USERID -H %H power
on</method>
</command>
<command name="off" defaultMethod="ssh">
<method name="ssh">ssh -l root %H init 0</method>
<method name="ipmi">ipmitool -I lan -A NONE -U USERID -H %H power
on</method>
</command>
<command name="custom_command">
...
</command>
si_power would then first find the command node in the config file for the
action specified on the command line (on, off, etc.). If it has found the
command, it would try to find the method name given in the cluster.txt. If
multiple method names are separated by comma (ssh, wol), it will try them
one by one until it finds a method for this command. If nothing matches or
if the power-control node in cluster.txt is empty it will use the default
method.
Although this is somewhat more difficult to implement, it should be very
easy to extent. Also since this would not be limited to power management, we
could even name this something more general like si_action.
What do you think?
Thomas Krause
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Andrea
Righi
Gesendet: Freitag, 2. Mai 2008 13:37
An: [email protected]
Betreff: Re: [sisuite-users] si_power tool
Thomas Krause wrote:
> I needed a simple tool to power off and restart my clients. So I wrote a
> small utility that can query the power status of clients and remotely
> restart or shutdown them.
This is absolutely useful and I think your implementation could be a
nice start. Thanks for raising this topic again.
After some thought with another interested sysadmin we decided that
probably the best approach to support any kind of power control
mechanism is to define a special tag in cluster.xml (via
si_clusterconfig). The value of this attribute will be used to specify
the command to control the power of any specific group of clients.
For example this could be a group defined by si_clusterconfig to control
IBM e326m servers via BMC and ipmitool:
<group>
<name>cluster1</name>
<image>RHEL5</image>
<override>RHEL5</override>
<node>node001-node100</node>
<power-control>ipmitool -I lan -A NONE -U USERID -H</power-control>
</group>
The <power-control> command above should be expanded by si_power in some
parallel tasks in the form:
ipmitool -I lan -A NONE -U USERID -H node001 power on
ipmitool -I lan -A NONE -U USERID -H node002 power on
...
ipmitool -I lan -A NONE -U USERID -H node100 power on
And maybe a reasonable syntax for si_power should be in this case:
# si_power -n cluster1 power on
The same for "power off", "power status" and "power cycle" and in part
the specific si_power command passed as argument would depend on the
particular syntax of the power control method.
Your implementation (power control via ssh) is a particular case and it
can be expressed in this way:
<group>
<name>cluster2</name>
<image>Ubuntu8.04</image>
<override>Ubuntu8.04</override>
<node>host1-host20</node>
<power-control>ssh -l root</power-control>
</group>
And the si_power syntax would be:
power off:
# si_power -n cluster2 init 0
reboot:
# si_power -n cluster2 init 6
Ok, this is a good example because it needs a different power control
method to power on clients respect to power off and reboot: the WOL (BTW
see this python script
http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wolpython.txt).
So, probably a more generic approach would be to differentiate each
single operations inside the <power-control> object. But maybe in this
way the syntax would become too much difficult to read / understand.
Re-writing the previous example (and supposing wol is the command to
turn on clients via WOL):
<group>
<name>cluster2</name>
<image>Ubuntu8.04</image>
<override>Ubuntu8.04</override>
<node>host1-host20</node>
<power-control>
<poweron>wol %H</poweron>
<poweroff>ssh -l root %H init 0</poweroff>
<reboot>ssh -l root %H init 6</reboot>
</power-control>
</group>
The special character %H would be resolved in each single host name by
si_power.
Another possible way could be to implement all the possible (known)
power control methods directly by specific SystemImager commands
(si_power_ipmi, si_power_wol, si_power_ssh, etc.) or by si_power
options, but I don't like this approach, because it's a lot of
development work, it doesn't scale at all, and can lead to many bugs
and errors due to different versions of the particular power control
methods (ipmi, wol, etc.).
In conclusion I would prefer a more generic approach, providing in
SystemImager all the abstract primitives to define all the possible
commands to control the clients' power.
Other ideas, criticisms, appreciations, suggestions, etc. are welcome.
-Andrea
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javao
ne
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users