diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py index 49451787086d53a8426d63e4fcc22cd601cb9466..fe6831da26a5169b015eef571ebad69e6d45583c 100644 --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@ -397,7 +397,8 @@ def ClusterCopyFile(opts, args): cluster_name = cl.QueryConfigValues(["cluster_name"])[0] results = GetOnlineNodes(nodes=opts.nodes, cl=cl, filter_master=True, - secondary_ips=opts.use_replication_network) + secondary_ips=opts.use_replication_network, + nodegroup=opts.nodegroup) srun = ssh.SshRunner(cluster_name=cluster_name) for node in results: @@ -421,7 +422,7 @@ def RunClusterCommand(opts, args): command = " ".join(args) - nodes = GetOnlineNodes(nodes=opts.nodes, cl=cl) + nodes = GetOnlineNodes(nodes=opts.nodes, cl=cl, nodegroup=opts.nodegroup) cluster_name, master_node = cl.QueryConfigValues(["cluster_name", "master_node"]) @@ -1288,11 +1289,11 @@ commands = { "", "Shows the cluster master"), 'copyfile': ( ClusterCopyFile, [ArgFile(min=1, max=1)], - [NODE_LIST_OPT, USE_REPL_NET_OPT], + [NODE_LIST_OPT, USE_REPL_NET_OPT, NODEGROUP_OPT], "[-n node...] <filename>", "Copies a file to all (or only some) nodes"), 'command': ( RunClusterCommand, [ArgCommand(min=1)], - [NODE_LIST_OPT], + [NODE_LIST_OPT, NODEGROUP_OPT], "[-n node...] <command>", "Runs a command on all (or only some) nodes"), 'info': ( ShowClusterConfig, ARGS_NONE, [ROMAN_OPT], diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst index a90f5fd96704b480f73a53063f79a86396e520fe..d84c36335a76f150d5fbed00ccbc6a072ac1fde5 100644 --- a/man/gnt-cluster.rst +++ b/man/gnt-cluster.rst @@ -37,7 +37,7 @@ interpreted as stdin. COMMAND ~~~~~~~ -**command** [-n *node*] {*command*} +**command** [-n *node*] [-g *group*] {*command*} Executes a command on all nodes. If the option ``-n`` is not given, the command will be executed on all nodes, otherwise it will be @@ -46,6 +46,11 @@ times for running it on multiple nodes, like:: # gnt-cluster command -n node1.example.com -n node2.example.com date +The ``-g`` option can be used to run a command only on a specific node +group, e.g.:: + + # gnt-cluster command -g default date + 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 @@ -67,12 +72,14 @@ and the command which will be executed will be ``ls -l /etc``. COPYFILE ~~~~~~~~ -**copyfile** [--use-replication-network] [-n *node*] {*file*} +| **copyfile** [--use-replication-network] [-n *node*] [-g *group*] +| {*file*} Copies a file to all or to some nodes. The argument specifies the source file (on the current system), the ``-n`` argument specifies the target node, or nodes if the option is given multiple times. If -``-n`` is not given at all, the file will be copied to all nodes. +``-n`` is not given at all, the file will be copied to all nodes. The +``-g`` option can be used to only select nodes in a specific node group. Passing the ``--use-replication-network`` option will cause the copy to be done over the replication network (only matters if the primary/secondary IPs are different). Example::