512vincent / pdsh

Automatically exported from code.google.com/p/pdsh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random pick in host list

GoogleCodeExporter opened this issue · comments

Hello,

It could be great if pdsh were able to sends its request to the hosts in a 
random order.

For example, with the following command:
  pdsh --random -w 10.1.1.[1-254],10.1.2.[1-254],10.1.3.[1-254] "hostname"
each pdsh thread would pick an item in this host list in a random order. E.g.:
 10.1.1.34
 10.1.2.263
 10.1.1.186
 10.1.3.150
 ...


Why? Case: nodes are packed in cooling racks by they ip address (one rack hosts 
all the 10.1.1.0 machines, another rack hosts all the 10.1.2.0 machines ...). 
So, picking randomly the hosts will distribute the "poweroff" calls among the 
racks and make less steep the ramp down of electrical power consumption.

Cheers,

Vincent

Original issue reported on code.google.com by vincent....@b12-consulting.com on 21 Aug 2012 at 3:17

Sorry, I missed this bug report for a bit.

You might be able to write a simple misc plugin to do what you want.
Unfortunately, long options are not yet supported in pdsh, but as an experiment 
you could choose an unused short option.

You would want to create a plugin that operates in the "postop" phase (after 
options processing). See the "nodeupdown" misc plugin for an example. At the 
time your plugin is called, opt->wcoll has been filled in with the list of 
hosts. Your plugin, when activated, would randomize this hostlist.


Original comment by mark.gro...@gmail.com on 17 Sep 2012 at 10:58