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