|
|
74096c |
From d425ed54261d5bc19aa853854cc3b64647e3c897 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Aravinda Vishwanathapura <aravinda@kadalu.io>
|
|
|
74096c |
Date: Sun, 12 Jul 2020 12:42:36 +0530
|
|
|
74096c |
Subject: [PATCH 461/465] geo-replication: Fix IPv6 parsing
|
|
|
74096c |
|
|
|
74096c |
Brick paths in Volinfo used `:` as delimiter, Geo-rep uses split
|
|
|
74096c |
based on `:` char. This will go wrong with IPv6.
|
|
|
74096c |
|
|
|
74096c |
This patch handles the IPv6 case and handles the split properly.
|
|
|
74096c |
Backport of:
|
|
|
74096c |
>Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/24706
|
|
|
74096c |
>Fixes: #1366
|
|
|
74096c |
>Change-Id: I25e88d693744381c0ccf3c1dbf1541b84be2499d
|
|
|
74096c |
>Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.io>
|
|
|
74096c |
|
|
|
74096c |
BUG: 1855966
|
|
|
74096c |
Change-Id: I25e88d693744381c0ccf3c1dbf1541b84be2499d
|
|
|
74096c |
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/208610
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
geo-replication/syncdaemon/master.py | 5 ++--
|
|
|
74096c |
geo-replication/syncdaemon/syncdutils.py | 43 +++++++++++++++++++++++++++++---
|
|
|
74096c |
2 files changed, 43 insertions(+), 5 deletions(-)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
|
|
|
74096c |
index 3f98337..08e98f8 100644
|
|
|
74096c |
--- a/geo-replication/syncdaemon/master.py
|
|
|
74096c |
+++ b/geo-replication/syncdaemon/master.py
|
|
|
74096c |
@@ -26,7 +26,8 @@ from rconf import rconf
|
|
|
74096c |
from syncdutils import Thread, GsyncdError, escape_space_newline
|
|
|
74096c |
from syncdutils import unescape_space_newline, gauxpfx, escape
|
|
|
74096c |
from syncdutils import lstat, errno_wrap, FreeObject, lf, matching_disk_gfid
|
|
|
74096c |
-from syncdutils import NoStimeAvailable, PartialHistoryAvailable
|
|
|
74096c |
+from syncdutils import NoStimeAvailable, PartialHistoryAvailable, host_brick_split
|
|
|
74096c |
+
|
|
|
74096c |
|
|
|
74096c |
URXTIME = (-1, 0)
|
|
|
74096c |
|
|
|
74096c |
@@ -1466,7 +1467,7 @@ class GMasterChangelogMixin(GMasterCommon):
|
|
|
74096c |
node = rconf.args.resource_remote
|
|
|
74096c |
node_data = node.split("@")
|
|
|
74096c |
node = node_data[-1]
|
|
|
74096c |
- remote_node_ip = node.split(":")[0]
|
|
|
74096c |
+ remote_node_ip, _ = host_brick_split(node)
|
|
|
74096c |
self.status.set_slave_node(remote_node_ip)
|
|
|
74096c |
|
|
|
74096c |
def changelogs_batch_process(self, changes):
|
|
|
74096c |
diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py
|
|
|
74096c |
index 7560fa1..f43e13b 100644
|
|
|
74096c |
--- a/geo-replication/syncdaemon/syncdutils.py
|
|
|
74096c |
+++ b/geo-replication/syncdaemon/syncdutils.py
|
|
|
74096c |
@@ -883,6 +883,19 @@ class Popen(subprocess.Popen):
|
|
|
74096c |
self.errfail()
|
|
|
74096c |
|
|
|
74096c |
|
|
|
74096c |
+def host_brick_split(value):
|
|
|
74096c |
+ """
|
|
|
74096c |
+ IPv6 compatible way to split and get the host
|
|
|
74096c |
+ and brick information. Example inputs:
|
|
|
74096c |
+ node1.example.com:/exports/bricks/brick1/brick
|
|
|
74096c |
+ fe80::af0f:df82:844f:ef66%utun0:/exports/bricks/brick1/brick
|
|
|
74096c |
+ """
|
|
|
74096c |
+ parts = value.split(":")
|
|
|
74096c |
+ brick = parts[-1]
|
|
|
74096c |
+ hostparts = parts[0:-1]
|
|
|
74096c |
+ return (":".join(hostparts), brick)
|
|
|
74096c |
+
|
|
|
74096c |
+
|
|
|
74096c |
class Volinfo(object):
|
|
|
74096c |
|
|
|
74096c |
def __init__(self, vol, host='localhost', prelude=[], master=True):
|
|
|
74096c |
@@ -925,7 +938,7 @@ class Volinfo(object):
|
|
|
74096c |
@memoize
|
|
|
74096c |
def bricks(self):
|
|
|
74096c |
def bparse(b):
|
|
|
74096c |
- host, dirp = b.find("name").text.split(':', 2)
|
|
|
74096c |
+ host, dirp = host_brick_split(b.find("name").text)
|
|
|
74096c |
return {'host': host, 'dir': dirp, 'uuid': b.find("hostUuid").text}
|
|
|
74096c |
return [bparse(b) for b in self.get('brick')]
|
|
|
74096c |
|
|
|
74096c |
@@ -1001,6 +1014,16 @@ class VolinfoFromGconf(object):
|
|
|
74096c |
def is_hot(self, brickpath):
|
|
|
74096c |
return False
|
|
|
74096c |
|
|
|
74096c |
+ def is_uuid(self, value):
|
|
|
74096c |
+ try:
|
|
|
74096c |
+ uuid.UUID(value)
|
|
|
74096c |
+ return True
|
|
|
74096c |
+ except ValueError:
|
|
|
74096c |
+ return False
|
|
|
74096c |
+
|
|
|
74096c |
+ def possible_path(self, value):
|
|
|
74096c |
+ return "/" in value
|
|
|
74096c |
+
|
|
|
74096c |
@property
|
|
|
74096c |
@memoize
|
|
|
74096c |
def bricks(self):
|
|
|
74096c |
@@ -1014,8 +1037,22 @@ class VolinfoFromGconf(object):
|
|
|
74096c |
out = []
|
|
|
74096c |
for b in bricks_data:
|
|
|
74096c |
parts = b.split(":")
|
|
|
74096c |
- bpath = parts[2] if len(parts) == 3 else ""
|
|
|
74096c |
- out.append({"host": parts[1], "dir": bpath, "uuid": parts[0]})
|
|
|
74096c |
+ b_uuid = None
|
|
|
74096c |
+ if self.is_uuid(parts[0]):
|
|
|
74096c |
+ b_uuid = parts[0]
|
|
|
74096c |
+ # Set all parts except first
|
|
|
74096c |
+ parts = parts[1:]
|
|
|
74096c |
+
|
|
|
74096c |
+ if self.possible_path(parts[-1]):
|
|
|
74096c |
+ bpath = parts[-1]
|
|
|
74096c |
+ # Set all parts except last
|
|
|
74096c |
+ parts = parts[0:-1]
|
|
|
74096c |
+
|
|
|
74096c |
+ out.append({
|
|
|
74096c |
+ "host": ":".join(parts), # if remaining parts are IPv6 name
|
|
|
74096c |
+ "dir": bpath,
|
|
|
74096c |
+ "uuid": b_uuid
|
|
|
74096c |
+ })
|
|
|
74096c |
|
|
|
74096c |
return out
|
|
|
74096c |
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|