|
|
256ebe |
From d7bb933742f4d9135621590bf13713633c549af1 Mon Sep 17 00:00:00 2001
|
|
|
256ebe |
From: Aravinda VK <avishwan@redhat.com>
|
|
|
256ebe |
Date: Thu, 14 Mar 2019 20:06:54 +0530
|
|
|
256ebe |
Subject: [PATCH 52/52] geo-rep: IPv6 support
|
|
|
256ebe |
|
|
|
256ebe |
`address_family=inet6` needs to be added while mounting master and
|
|
|
256ebe |
slave volumes in gverify script.
|
|
|
256ebe |
|
|
|
256ebe |
New option introduced to gluster cli(`--inet6`) which will be used
|
|
|
256ebe |
internally by geo-rep while calling `gluster volume info
|
|
|
256ebe |
--remote-host=<ipv6>`.
|
|
|
256ebe |
|
|
|
256ebe |
Backport of https://review.gluster.org/22363
|
|
|
256ebe |
|
|
|
256ebe |
Fixes: bz#1688231
|
|
|
256ebe |
Change-Id: I1e0d42cae07158df043e64a2f991882d8c897837
|
|
|
256ebe |
Signed-off-by: Aravinda VK <avishwan@redhat.com>
|
|
|
256ebe |
Reviewed-on: https://code.engineering.redhat.com/gerrit/167120
|
|
|
256ebe |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
256ebe |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
256ebe |
---
|
|
|
256ebe |
cli/src/cli.c | 11 ++++++++++
|
|
|
256ebe |
cli/src/cli.h | 1 +
|
|
|
256ebe |
geo-replication/src/gverify.sh | 22 ++++++++++++++++----
|
|
|
256ebe |
geo-replication/syncdaemon/argsupgrade.py | 13 +++++++++++-
|
|
|
256ebe |
geo-replication/syncdaemon/gsyncd.py | 1 +
|
|
|
256ebe |
geo-replication/syncdaemon/subcmds.py | 9 +++++++--
|
|
|
256ebe |
xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 30 ++++++++++++++++++++++++++--
|
|
|
256ebe |
7 files changed, 78 insertions(+), 9 deletions(-)
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/cli/src/cli.c b/cli/src/cli.c
|
|
|
256ebe |
index 08f117e..c33d152 100644
|
|
|
256ebe |
--- a/cli/src/cli.c
|
|
|
256ebe |
+++ b/cli/src/cli.c
|
|
|
256ebe |
@@ -433,6 +433,12 @@ cli_opt_parse(char *opt, struct cli_state *state)
|
|
|
256ebe |
return 0;
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
+ oarg = strtail(opt, "inet6");
|
|
|
256ebe |
+ if (oarg) {
|
|
|
256ebe |
+ state->address_family = "inet6";
|
|
|
256ebe |
+ return 0;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
oarg = strtail(opt, "log-file=");
|
|
|
256ebe |
if (oarg) {
|
|
|
256ebe |
state->log_file = oarg;
|
|
|
256ebe |
@@ -679,6 +685,11 @@ cli_rpc_init(struct cli_state *state)
|
|
|
256ebe |
this = THIS;
|
|
|
256ebe |
cli_rpc_prog = &cli_prog;
|
|
|
256ebe |
|
|
|
256ebe |
+ /* If address family specified in CLI */
|
|
|
256ebe |
+ if (state->address_family) {
|
|
|
256ebe |
+ addr_family = state->address_family;
|
|
|
256ebe |
+ }
|
|
|
256ebe |
+
|
|
|
256ebe |
/* Connect to glusterd using the specified method, giving preference
|
|
|
256ebe |
* to a unix socket connection. If nothing is specified, connect to
|
|
|
256ebe |
* the default glusterd socket.
|
|
|
256ebe |
diff --git a/cli/src/cli.h b/cli/src/cli.h
|
|
|
256ebe |
index 5df86d5..b79a0a2 100644
|
|
|
256ebe |
--- a/cli/src/cli.h
|
|
|
256ebe |
+++ b/cli/src/cli.h
|
|
|
256ebe |
@@ -136,6 +136,7 @@ struct cli_state {
|
|
|
256ebe |
gf_loglevel_t log_level;
|
|
|
256ebe |
|
|
|
256ebe |
char *glusterd_sock;
|
|
|
256ebe |
+ char *address_family;
|
|
|
256ebe |
};
|
|
|
256ebe |
|
|
|
256ebe |
struct cli_local {
|
|
|
256ebe |
diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh
|
|
|
256ebe |
index d048de0..7c88f9f 100755
|
|
|
256ebe |
--- a/geo-replication/src/gverify.sh
|
|
|
256ebe |
+++ b/geo-replication/src/gverify.sh
|
|
|
256ebe |
@@ -94,6 +94,7 @@ echo $cmd_line;
|
|
|
256ebe |
function master_stats()
|
|
|
256ebe |
{
|
|
|
256ebe |
MASTERVOL=$1;
|
|
|
256ebe |
+ local inet6=$2;
|
|
|
256ebe |
local d;
|
|
|
256ebe |
local i;
|
|
|
256ebe |
local disk_size;
|
|
|
256ebe |
@@ -102,7 +103,12 @@ function master_stats()
|
|
|
256ebe |
local m_status;
|
|
|
256ebe |
|
|
|
256ebe |
d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null);
|
|
|
256ebe |
- glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d;
|
|
|
256ebe |
+ if [ "$inet6" = "inet6" ]; then
|
|
|
256ebe |
+ glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-id $MASTERVOL -l $master_log_file $d;
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d;
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+
|
|
|
256ebe |
i=$(get_inode_num $d);
|
|
|
256ebe |
if [[ "$i" -ne "1" ]]; then
|
|
|
256ebe |
echo 0:0;
|
|
|
256ebe |
@@ -124,12 +130,18 @@ function slave_stats()
|
|
|
256ebe |
SLAVEUSER=$1;
|
|
|
256ebe |
SLAVEHOST=$2;
|
|
|
256ebe |
SLAVEVOL=$3;
|
|
|
256ebe |
+ local inet6=$4;
|
|
|
256ebe |
local cmd_line;
|
|
|
256ebe |
local ver;
|
|
|
256ebe |
local status;
|
|
|
256ebe |
|
|
|
256ebe |
d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null);
|
|
|
256ebe |
- glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d;
|
|
|
256ebe |
+ if [ "$inet6" = "inet6" ]; then
|
|
|
256ebe |
+ glusterfs --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d;
|
|
|
256ebe |
+ else
|
|
|
256ebe |
+ glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d;
|
|
|
256ebe |
+ fi
|
|
|
256ebe |
+
|
|
|
256ebe |
i=$(get_inode_num $d);
|
|
|
256ebe |
if [[ "$i" -ne "1" ]]; then
|
|
|
256ebe |
echo 0:0;
|
|
|
256ebe |
@@ -167,6 +179,8 @@ function main()
|
|
|
256ebe |
log_file=$6
|
|
|
256ebe |
> $log_file
|
|
|
256ebe |
|
|
|
256ebe |
+ inet6=$7
|
|
|
256ebe |
+
|
|
|
256ebe |
# Use FORCE_BLOCKER flag in the error message to differentiate
|
|
|
256ebe |
# between the errors which the force command should bypass
|
|
|
256ebe |
|
|
|
256ebe |
@@ -204,8 +218,8 @@ function main()
|
|
|
256ebe |
fi;
|
|
|
256ebe |
|
|
|
256ebe |
ERRORS=0;
|
|
|
256ebe |
- master_data=$(master_stats $1);
|
|
|
256ebe |
- slave_data=$(slave_stats $2 $3 $4);
|
|
|
256ebe |
+ master_data=$(master_stats $1 ${inet6});
|
|
|
256ebe |
+ slave_data=$(slave_stats $2 $3 $4 ${inet6});
|
|
|
256ebe |
master_disk_size=$(echo $master_data | cut -f1 -d':');
|
|
|
256ebe |
slave_disk_size=$(echo $slave_data | cut -f1 -d':');
|
|
|
256ebe |
master_used_size=$(echo $master_data | cut -f2 -d':');
|
|
|
256ebe |
diff --git a/geo-replication/syncdaemon/argsupgrade.py b/geo-replication/syncdaemon/argsupgrade.py
|
|
|
256ebe |
index 4018143..7af4063 100644
|
|
|
256ebe |
--- a/geo-replication/syncdaemon/argsupgrade.py
|
|
|
256ebe |
+++ b/geo-replication/syncdaemon/argsupgrade.py
|
|
|
256ebe |
@@ -84,6 +84,10 @@ def upgrade():
|
|
|
256ebe |
# fail when it does stat to check the existence.
|
|
|
256ebe |
init_gsyncd_template_conf()
|
|
|
256ebe |
|
|
|
256ebe |
+ inet6 = False
|
|
|
256ebe |
+ if "--inet6" in sys.argv:
|
|
|
256ebe |
+ inet6 = True
|
|
|
256ebe |
+
|
|
|
256ebe |
if "--monitor" in sys.argv:
|
|
|
256ebe |
# python gsyncd.py --path=/bricks/b1
|
|
|
256ebe |
# --monitor -c gsyncd.conf
|
|
|
256ebe |
@@ -147,8 +151,11 @@ def upgrade():
|
|
|
256ebe |
|
|
|
256ebe |
user, hname = remote_addr.split("@")
|
|
|
256ebe |
|
|
|
256ebe |
+ if not inet6:
|
|
|
256ebe |
+ hname = gethostbyname(hname)
|
|
|
256ebe |
+
|
|
|
256ebe |
print(("ssh://%s@%s:gluster://127.0.0.1:%s" % (
|
|
|
256ebe |
- user, gethostbyname(hname), vol)))
|
|
|
256ebe |
+ user, hname, vol)))
|
|
|
256ebe |
|
|
|
256ebe |
sys.exit(0)
|
|
|
256ebe |
elif "--normalize-url" in sys.argv:
|
|
|
256ebe |
@@ -346,3 +353,7 @@ def upgrade():
|
|
|
256ebe |
|
|
|
256ebe |
if pargs.reset_sync_time:
|
|
|
256ebe |
sys.argv.append("--reset-sync-time")
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if inet6:
|
|
|
256ebe |
+ # Add `--inet6` as first argument
|
|
|
256ebe |
+ sys.argv = [sys.argv[0], "--inet6"] + sys.argv[1:]
|
|
|
256ebe |
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
|
|
|
256ebe |
index 037f351..effe0ce 100644
|
|
|
256ebe |
--- a/geo-replication/syncdaemon/gsyncd.py
|
|
|
256ebe |
+++ b/geo-replication/syncdaemon/gsyncd.py
|
|
|
256ebe |
@@ -47,6 +47,7 @@ def main():
|
|
|
256ebe |
sys.exit(0)
|
|
|
256ebe |
|
|
|
256ebe |
parser = ArgumentParser()
|
|
|
256ebe |
+ parser.add_argument("--inet6", action="store_true")
|
|
|
256ebe |
sp = parser.add_subparsers(dest="subcmd")
|
|
|
256ebe |
|
|
|
256ebe |
# Monitor Status File update
|
|
|
256ebe |
diff --git a/geo-replication/syncdaemon/subcmds.py b/geo-replication/syncdaemon/subcmds.py
|
|
|
256ebe |
index 30050ec..4ece7e0 100644
|
|
|
256ebe |
--- a/geo-replication/syncdaemon/subcmds.py
|
|
|
256ebe |
+++ b/geo-replication/syncdaemon/subcmds.py
|
|
|
256ebe |
@@ -110,8 +110,13 @@ def subcmd_voluuidget(args):
|
|
|
256ebe |
|
|
|
256ebe |
ParseError = XET.ParseError if hasattr(XET, 'ParseError') else SyntaxError
|
|
|
256ebe |
|
|
|
256ebe |
- po = Popen(['gluster', '--xml', '--remote-host=' + args.host,
|
|
|
256ebe |
- 'volume', 'info', args.volname], bufsize=0,
|
|
|
256ebe |
+ cmd = ['gluster', '--xml', '--remote-host=' + args.host,
|
|
|
256ebe |
+ 'volume', 'info', args.volname]
|
|
|
256ebe |
+
|
|
|
256ebe |
+ if args.inet6:
|
|
|
256ebe |
+ cmd.append("--inet6")
|
|
|
256ebe |
+
|
|
|
256ebe |
+ po = Popen(cmd, bufsize=0,
|
|
|
256ebe |
stdin=None, stdout=PIPE, stderr=PIPE,
|
|
|
256ebe |
universal_newlines=True)
|
|
|
256ebe |
|
|
|
256ebe |
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
256ebe |
index 49baa58..0f40bea 100644
|
|
|
256ebe |
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
256ebe |
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
|
|
|
256ebe |
@@ -76,6 +76,19 @@ static char *gsync_reserved_opts[] = {"gluster-command",
|
|
|
256ebe |
static char *gsync_no_restart_opts[] = {"checkpoint", "log_rsync_performance",
|
|
|
256ebe |
"log-rsync-performance", NULL};
|
|
|
256ebe |
|
|
|
256ebe |
+void
|
|
|
256ebe |
+set_gsyncd_inet6_arg(runner_t *runner)
|
|
|
256ebe |
+{
|
|
|
256ebe |
+ xlator_t *this = NULL;
|
|
|
256ebe |
+ char *af;
|
|
|
256ebe |
+ int ret;
|
|
|
256ebe |
+
|
|
|
256ebe |
+ this = THIS;
|
|
|
256ebe |
+ ret = dict_get_str(this->options, "transport.address-family", &af);
|
|
|
256ebe |
+ if (ret == 0)
|
|
|
256ebe |
+ runner_argprintf(runner, "--%s", af);
|
|
|
256ebe |
+}
|
|
|
256ebe |
+
|
|
|
256ebe |
int
|
|
|
256ebe |
__glusterd_handle_sys_exec(rpcsvc_request_t *req)
|
|
|
256ebe |
{
|
|
|
256ebe |
@@ -384,6 +397,7 @@ glusterd_urltransform_init(runner_t *runner, const char *transname)
|
|
|
256ebe |
{
|
|
|
256ebe |
runinit(runner);
|
|
|
256ebe |
runner_add_arg(runner, GSYNCD_PREFIX "/gsyncd");
|
|
|
256ebe |
+ set_gsyncd_inet6_arg(runner);
|
|
|
256ebe |
runner_argprintf(runner, "--%s-url", transname);
|
|
|
256ebe |
}
|
|
|
256ebe |
|
|
|
256ebe |
@@ -725,6 +739,7 @@ glusterd_get_slave_voluuid(char *slave_host, char *slave_vol, char *vol_uuid)
|
|
|
256ebe |
|
|
|
256ebe |
runinit(&runner);
|
|
|
256ebe |
runner_add_arg(&runner, GSYNCD_PREFIX "/gsyncd");
|
|
|
256ebe |
+ set_gsyncd_inet6_arg(&runner);
|
|
|
256ebe |
runner_add_arg(&runner, "--slavevoluuid-get");
|
|
|
256ebe |
runner_argprintf(&runner, "%s::%s", slave_host, slave_vol);
|
|
|
256ebe |
|
|
|
256ebe |
@@ -788,6 +803,7 @@ glusterd_gsync_get_config(char *master, char *slave, char *conf_path,
|
|
|
256ebe |
runinit(&runner);
|
|
|
256ebe |
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", "-c", NULL);
|
|
|
256ebe |
runner_argprintf(&runner, "%s", conf_path);
|
|
|
256ebe |
+ set_gsyncd_inet6_arg(&runner);
|
|
|
256ebe |
runner_argprintf(&runner, "--iprefix=%s", DATADIR);
|
|
|
256ebe |
runner_argprintf(&runner, ":%s", master);
|
|
|
256ebe |
runner_add_args(&runner, slave, "--config-get-all", NULL);
|
|
|
256ebe |
@@ -917,6 +933,7 @@ glusterd_gsync_get_status(char *master, char *slave, char *conf_path,
|
|
|
256ebe |
runinit(&runner);
|
|
|
256ebe |
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", "-c", NULL);
|
|
|
256ebe |
runner_argprintf(&runner, "%s", conf_path);
|
|
|
256ebe |
+ set_gsyncd_inet6_arg(&runner);
|
|
|
256ebe |
runner_argprintf(&runner, "--iprefix=%s", DATADIR);
|
|
|
256ebe |
runner_argprintf(&runner, ":%s", master);
|
|
|
256ebe |
runner_add_args(&runner, slave, "--status-get", NULL);
|
|
|
256ebe |
@@ -937,6 +954,7 @@ glusterd_gsync_get_param_file(char *prmfile, const char *param, char *master,
|
|
|
256ebe |
runinit(&runner);
|
|
|
256ebe |
runner_add_args(&runner, GSYNCD_PREFIX "/gsyncd", "-c", NULL);
|
|
|
256ebe |
runner_argprintf(&runner, "%s", conf_path);
|
|
|
256ebe |
+ set_gsyncd_inet6_arg(&runner);
|
|
|
256ebe |
runner_argprintf(&runner, "--iprefix=%s", DATADIR);
|
|
|
256ebe |
runner_argprintf(&runner, ":%s", master);
|
|
|
256ebe |
runner_add_args(&runner, slave, "--config-get", NULL);
|
|
|
256ebe |
@@ -2811,6 +2829,7 @@ glusterd_verify_slave(char *volname, char *slave_url, char *slave_vol,
|
|
|
256ebe |
char *slave_ip = NULL;
|
|
|
256ebe |
glusterd_conf_t *priv = NULL;
|
|
|
256ebe |
xlator_t *this = NULL;
|
|
|
256ebe |
+ char *af = NULL;
|
|
|
256ebe |
|
|
|
256ebe |
this = THIS;
|
|
|
256ebe |
GF_ASSERT(this);
|
|
|
256ebe |
@@ -2852,9 +2871,16 @@ glusterd_verify_slave(char *volname, char *slave_url, char *slave_vol,
|
|
|
256ebe |
runner_argprintf(&runner, "%s", slave_vol);
|
|
|
256ebe |
runner_argprintf(&runner, "%d", ssh_port);
|
|
|
256ebe |
runner_argprintf(&runner, "%s", log_file_path);
|
|
|
256ebe |
- gf_msg_debug(this->name, 0, "gverify Args = %s %s %s %s %s %s %s",
|
|
|
256ebe |
+ ret = dict_get_str(this->options, "transport.address-family", &af);
|
|
|
256ebe |
+ if (ret)
|
|
|
256ebe |
+ af = "-";
|
|
|
256ebe |
+
|
|
|
256ebe |
+ runner_argprintf(&runner, "%s", af);
|
|
|
256ebe |
+
|
|
|
256ebe |
+ gf_msg_debug(this->name, 0, "gverify Args = %s %s %s %s %s %s %s %s",
|
|
|
256ebe |
runner.argv[0], runner.argv[1], runner.argv[2], runner.argv[3],
|
|
|
256ebe |
- runner.argv[4], runner.argv[5], runner.argv[6]);
|
|
|
256ebe |
+ runner.argv[4], runner.argv[5], runner.argv[6],
|
|
|
256ebe |
+ runner.argv[7]);
|
|
|
256ebe |
runner_redir(&runner, STDOUT_FILENO, RUN_PIPE);
|
|
|
256ebe |
synclock_unlock(&priv->big_lock);
|
|
|
256ebe |
ret = runner_run(&runner);
|
|
|
256ebe |
--
|
|
|
256ebe |
1.8.3.1
|
|
|
256ebe |
|