Commit 5f83e263 authored by Iustin Pop's avatar Iustin Pop
Browse files

Change the 'gnt-cluster command' execution order

This patch makes the command execute last on the master (if the master
is selected). The order for the other nodes is unchanged.

The patch also updates the man page with some explanations and an
example.

Reviewed-by: imsnah
parent b5401f2f
...@@ -1039,7 +1039,7 @@ class LUSetClusterParams(LogicalUnit): ...@@ -1039,7 +1039,7 @@ class LUSetClusterParams(LogicalUnit):
"""Check prerequisites. """Check prerequisites.
This checks whether the given params don't conflict and This checks whether the given params don't conflict and
if the given volume group is valid. if the given volume group is valid.
""" """
if not self.op.vg_name: if not self.op.vg_name:
...@@ -1832,6 +1832,12 @@ class LURunClusterCommand(NoHooksLU): ...@@ -1832,6 +1832,12 @@ class LURunClusterCommand(NoHooksLU):
"""Run a command on some nodes. """Run a command on some nodes.
""" """
# put the master at the end of the nodes list
master_node = self.sstore.GetMasterNode()
if master_node in self.nodes:
self.nodes.remove(master_node)
self.nodes.append(master_node)
data = [] data = []
for node in self.nodes: for node in self.nodes:
result = self.ssh.Run(node, "root", self.op.command) result = self.ssh.Run(node, "root", self.op.command)
......
...@@ -101,6 +101,21 @@ ...@@ -101,6 +101,21 @@
</para> </para>
<para>
The command is executed serially on the selected nodes. If the
master node is present in the list, the command will be
executed last on the master. Regarding the other nodes, the
execution order is somewhat alphabetic (it's smarter so that
node2.example.com will be earlier than node10.example.com but
after node1.example.com).
</para>
<para>
So given the node names node1, node2, node3, node10, node11,
with node3 being the master, the order will be: node1, node2,
node10, node11, node3.
</para>
<para> <para>
The command is constructed by concatenating all other command The command is constructed by concatenating all other command
line arguments. For example, to list the contents of the line arguments. For example, to list the contents of the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment