summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-09-02 22:21:16 -0700
committerShreyas Siravara <sshreyas@fb.com>2017-09-03 05:42:35 +0000
commit26776c3d21e70806237dcc02ac4bd78883416718 (patch)
tree00cba84c0d08c6aa293c3acedf78b70deac849a8 /libglusterfs/src
parent32d15f6911ac5aa8f0280cb3c23fc7d97e8b000f (diff)
glusterd: Log & print old clients when doing a volume set operation
Summary: - Prior to this diff, Gluster would simply log "One more more clients cannot ..." - With this diff, we now show up to 20 clients that are mismatched. - This is a port of D3313082 to 3.8 Reviewers: rwareing, kvigor Reviewed By: kvigor Change-Id: Ia8830f18c922bda1aee787a2e3d6033164bb64d4 Reviewed-on: https://review.gluster.org/18196 Reviewed-by: Shreyas Siravara <sshreyas@fb.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/common-utils.c39
-rw-r--r--libglusterfs/src/common-utils.h3
2 files changed, 42 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index e533992556b..dbb33812287 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4539,3 +4539,42 @@ gf_bits_index (uint64_t n)
{
return ffsll(n) - 1;
}
+
+
+int
+gf_peerinfo_to_hostname_and_port (const char *peerinfo, char **hostname)
+{
+ int ret = -EINVAL;
+ char *ip = NULL;
+
+ GF_VALIDATE_OR_GOTO (THIS->name, peerinfo, out);
+ GF_VALIDATE_OR_GOTO (THIS->name, hostname, out);
+
+ *hostname = NULL;
+
+ ip = strdupa (peerinfo);
+
+ char *c = strrchr (ip, ':');
+ if (!c)
+ goto err;
+
+ *c = '\0';
+
+ *hostname = gf_rev_dns_lookup (ip);
+ if (!*hostname) {
+ *hostname = gf_strdup (ip);
+ if (!*hostname) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ }
+
+ ret = 0;
+ goto out;
+
+err:
+ GF_FREE (*hostname);
+ *hostname = NULL;
+out:
+ return ret;
+}
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 5e338f69528..ae96c9bc1a1 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -846,4 +846,7 @@ gf_bits_count (uint64_t n);
int32_t
gf_bits_index (uint64_t n);
+int
+gf_peerinfo_to_hostname_and_port (const char *peerinfo, char **hostname);
+
#endif /* _COMMON_UTILS_H */