Skip to content
Snippets Groups Projects
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 <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent e9e26bb3
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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
......
......@@ -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)],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment