Commit 74adc100 authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow cluster copy file over the replication net

This patch introduces the option “--use-replication-network” for the
cluster copyfile functionality, which is useful if the primary and
secondary network are significantly different (see issue 32).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent e9e26bb3
......@@ -123,6 +123,7 @@ __all__ = [
......@@ -890,6 +891,12 @@ NEW_CONFD_HMAC_KEY_OPT = cli_option("--new-confd-hmac-key",
help=("Create a new HMAC key for %s" %
USE_REPL_NET_OPT = cli_option("--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.
......@@ -138,6 +138,7 @@
<arg>-n <replaceable>node</replaceable></arg>
<arg choice="req"><replaceable>file</replaceable></arg>
......@@ -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).
# gnt-cluster -n -n copyfile /tmp/test
......@@ -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,
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)],
"[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
'command': (
RunClusterCommand, [ArgCommand(min=1)],
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