diff --git a/lib/cli.py b/lib/cli.py index 1edbffd24c0721c1eeef32e919eb314ff27d82f9..9c480d67ad6a4f9dce3183b6c8de1f5fe77a8f90 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -123,6 +123,7 @@ __all__ = [ "TAG_SRC_OPT", "TIMEOUT_OPT", "USEUNITS_OPT", + "USE_REPL_NET_OPT", "VERBOSE_OPT", "VG_NAME_OPT", "YES_DOIT_OPT", @@ -890,6 +891,12 @@ NEW_CONFD_HMAC_KEY_OPT = cli_option("--new-confd-hmac-key", help=("Create a new HMAC key for %s" % constants.CONFD)) +USE_REPL_NET_OPT = cli_option("--use-replication-network", + dest="use_replication_network", + help="Whether to use the replication network" + " for talking to the nodes", + action="store_true", default=False) + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/man/gnt-cluster.sgml b/man/gnt-cluster.sgml index 450f4048c875360c17ea921ac1ca9db46c6fc29a..bc1947b0d255e909e0ab2cf1a4dc20fdf4ed1e2f 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -138,6 +138,7 @@ <cmdsynopsis> <command>copyfile</command> + <arg>--use-replication-network</arg> <arg>-n <replaceable>node</replaceable></arg> <arg choice="req"><replaceable>file</replaceable></arg> </cmdsynopsis> @@ -150,6 +151,10 @@ <option>-n</option> is not given at all, the file will be copied to all nodes. + Passing the <option>--use-replication-network</option> option + will cause the copy to be done over the replication network + (only matters if the primary/secondary IPs are different). + Example: <screen> # gnt-cluster -n node1.example.com -n node2.example.com copyfile /tmp/test diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 50e68fe4fafd52a6765c717113bfc667cb09a83a..570be2274f9547d0c7f6437a5320790391667301 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -300,12 +300,10 @@ def ClusterCopyFile(opts, args): cl = GetClient() - myname = utils.GetHostInfo().name - cluster_name = cl.QueryConfigValues(["cluster_name"])[0] - results = GetOnlineNodes(nodes=opts.nodes, cl=cl) - results = [name for name in results if name != myname] + results = GetOnlineNodes(nodes=opts.nodes, cl=cl, filter_master=True, + secondary_ips=opts.use_replication_network) srun = ssh.SshRunner(cluster_name=cluster_name) for node in results: @@ -749,7 +747,7 @@ commands = { "", "Shows the cluster master"), 'copyfile': ( ClusterCopyFile, [ArgFile(min=1, max=1)], - [NODE_LIST_OPT], + [NODE_LIST_OPT, USE_REPL_NET_OPT], "[-n node...] <filename>", "Copies a file to all (or only some) nodes"), 'command': ( RunClusterCommand, [ArgCommand(min=1)],