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