diff options
| author | Aravinda VK <avishwan@redhat.com> | 2019-03-14 20:06:54 +0530 | 
|---|---|---|
| committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2019-04-17 13:58:46 +0000 | 
| commit | cbb52082da9d968908dc2f62b59328e948ced271 (patch) | |
| tree | 230a443d21601134ed0d43ffbc76c071c0d59ece /geo-replication | |
| parent | f39fc92d6521a5b87a635dd35989c0af90e7b789 (diff) | |
geo-rep: IPv6 support
`address_family=inet6` needs to be added while mounting master and
slave volumes in gverify script.
New option introduced to gluster cli(`--inet6`) which will be used
internally by geo-rep while calling `gluster volume info
--remote-host=<ipv6>`.
Backport of https://review.gluster.org/22363
Fixes: bz#1695436
Change-Id: I1e0d42cae07158df043e64a2f991882d8c897837
Signed-off-by: Aravinda VK <avishwan@redhat.com>
(cherry picked from commit 240e1d6821fbb779c3dd73f6f0225d755a5b7cc6)
Diffstat (limited to 'geo-replication')
| -rwxr-xr-x | geo-replication/src/gverify.sh | 22 | ||||
| -rw-r--r-- | geo-replication/syncdaemon/argsupgrade.py | 13 | ||||
| -rw-r--r-- | geo-replication/syncdaemon/gsyncd.py | 1 | ||||
| -rw-r--r-- | geo-replication/syncdaemon/subcmds.py | 9 | 
4 files changed, 38 insertions, 7 deletions
diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh index d048de0992b..7c88f9f682d 100755 --- a/geo-replication/src/gverify.sh +++ b/geo-replication/src/gverify.sh @@ -94,6 +94,7 @@ echo $cmd_line;  function master_stats()  {      MASTERVOL=$1; +    local inet6=$2;      local d;      local i;      local disk_size; @@ -102,7 +103,12 @@ function master_stats()      local m_status;      d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null); -    glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d; +    if [ "$inet6" = "inet6" ]; then +        glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-id $MASTERVOL -l $master_log_file $d; +    else +        glusterfs -s localhost --xlator-option="*dht.lookup-unhashed=off" --volfile-id $MASTERVOL -l $master_log_file $d; +    fi +      i=$(get_inode_num $d);      if [[ "$i" -ne "1" ]]; then          echo 0:0; @@ -124,12 +130,18 @@ function slave_stats()      SLAVEUSER=$1;      SLAVEHOST=$2;      SLAVEVOL=$3; +    local inet6=$4;      local cmd_line;      local ver;      local status;      d=$(mktemp -d -t ${0##*/}.XXXXXX 2>/dev/null); -    glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; +    if [ "$inet6" = "inet6" ]; then +        glusterfs --xlator-option="*dht.lookup-unhashed=off" --xlator-option="transport.address-family=inet6" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; +    else +        glusterfs --xlator-option="*dht.lookup-unhashed=off" --volfile-server $SLAVEHOST --volfile-id $SLAVEVOL -l $slave_log_file $d; +    fi +      i=$(get_inode_num $d);      if [[ "$i" -ne "1" ]]; then          echo 0:0; @@ -167,6 +179,8 @@ function main()      log_file=$6      > $log_file +    inet6=$7 +      # Use FORCE_BLOCKER flag in the error message to differentiate      # between the errors which the force command should bypass @@ -204,8 +218,8 @@ function main()      fi;      ERRORS=0; -    master_data=$(master_stats $1); -    slave_data=$(slave_stats $2 $3 $4); +    master_data=$(master_stats $1 ${inet6}); +    slave_data=$(slave_stats $2 $3 $4 ${inet6});      master_disk_size=$(echo $master_data | cut -f1 -d':');      slave_disk_size=$(echo $slave_data | cut -f1 -d':');      master_used_size=$(echo $master_data | cut -f2 -d':'); diff --git a/geo-replication/syncdaemon/argsupgrade.py b/geo-replication/syncdaemon/argsupgrade.py index 4018143b8b4..7af40633ef8 100644 --- a/geo-replication/syncdaemon/argsupgrade.py +++ b/geo-replication/syncdaemon/argsupgrade.py @@ -84,6 +84,10 @@ def upgrade():      # fail when it does stat to check the existence.      init_gsyncd_template_conf() +    inet6 = False +    if "--inet6" in sys.argv: +        inet6 = True +      if "--monitor" in sys.argv:          # python gsyncd.py --path=/bricks/b1          # --monitor -c gsyncd.conf @@ -147,8 +151,11 @@ def upgrade():              user, hname = remote_addr.split("@") +            if not inet6: +                hname = gethostbyname(hname) +              print(("ssh://%s@%s:gluster://127.0.0.1:%s" % ( -                user, gethostbyname(hname), vol))) +                user, hname, vol)))          sys.exit(0)      elif "--normalize-url" in sys.argv: @@ -346,3 +353,7 @@ def upgrade():          if pargs.reset_sync_time:              sys.argv.append("--reset-sync-time") + +    if inet6: +        # Add `--inet6` as first argument +        sys.argv = [sys.argv[0], "--inet6"] + sys.argv[1:] diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 037f351151b..effe0ce6aa2 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -47,6 +47,7 @@ def main():          sys.exit(0)      parser = ArgumentParser() +    parser.add_argument("--inet6", action="store_true")      sp = parser.add_subparsers(dest="subcmd")      # Monitor Status File update diff --git a/geo-replication/syncdaemon/subcmds.py b/geo-replication/syncdaemon/subcmds.py index 30050ec4743..4ece7e06b89 100644 --- a/geo-replication/syncdaemon/subcmds.py +++ b/geo-replication/syncdaemon/subcmds.py @@ -110,8 +110,13 @@ def subcmd_voluuidget(args):      ParseError = XET.ParseError if hasattr(XET, 'ParseError') else SyntaxError -    po = Popen(['gluster', '--xml', '--remote-host=' + args.host, -                'volume', 'info', args.volname], bufsize=0, +    cmd = ['gluster', '--xml', '--remote-host=' + args.host, +           'volume', 'info', args.volname] + +    if args.inet6: +        cmd.append("--inet6") + +    po = Popen(cmd, bufsize=0,                 stdin=None, stdout=PIPE, stderr=PIPE,                 universal_newlines=True)  | 
