summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-06-23 10:28:54 +0530
committerAnand Avati <avati@redhat.com>2012-07-02 11:09:13 -0700
commit4df765df74b4406c7cce90e66c4256e3850a8c5f (patch)
tree086a66c116b55cd58f025d4464a3ca732d734127
parent4df8241e740255744deea983f5e0c63ade202409 (diff)
glusterd, cli: handle uuid conflicts in probe gracefully
A commonly faced problem among glusterfs users is: after a fresh installation of glusterfs in a virtual machine, the VM image is cloned to make multiple instances of the server. This breaks glusterd because right after glusterfs installation on the first boot glusterd would have created the node UUID and this gets inherited into the clone. The result is wierd behavior at the time of peer probe where glusterd does not (yet) deal with UUID collisions in a user friendly way. With this patch the peer which got the probe request will compare the uuid of the machine which send the probe request with its own uuid and send the proper error to cli if the uuids are same. Change-Id: I091741ec863431fb6480a09a3f4c68a0906a3339 BUG: 811493 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3612 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--cli/src/cli-rpc-ops.c11
-rw-r--r--rpc/rpc-lib/src/protocol-common.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c15
3 files changed, 24 insertions, 3 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 492be4388e7..a40fd482947 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -129,8 +129,8 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov,
break;
default:
snprintf (msg, sizeof (msg),
- "Probe returned with unknown errno %d",
- rsp.op_errno);
+ "Probe returned with unknown errno"
+ " %d", rsp.op_errno);
break;
}
}
@@ -168,7 +168,12 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov,
"information on %s" ,
rsp.hostname);
break;
-
+ case GF_PROBE_SAME_UUID:
+ snprintf (msg, sizeof (msg),
+ "Peer uuid (host: %s) is"
+ "same as local uuid",
+ rsp.hostname);
+ break;
default:
snprintf (msg, sizeof (msg),
"Probe unsuccessful\nProbe "
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index dc93f07dc2d..c6b8659476c 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -94,6 +94,7 @@ enum gf_probe_resp {
GF_PROBE_FRIEND,
GF_PROBE_ANOTHER_CLUSTER,
GF_PROBE_VOLUME_CONFLICT,
+ GF_PROBE_SAME_UUID,
GF_PROBE_UNKNOWN_PEER,
GF_PROBE_ADD_FAILED
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 51b859857b2..63d53ef2a1e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1753,6 +1753,20 @@ glusterd_handle_probe_query (rpcsvc_request_t *req)
gf_log ("glusterd", GF_LOG_INFO,
"Received probe from uuid: %s", uuid_utoa (probe_req.uuid));
+ /* Check for uuid collision and handle it in a user friendly way by
+ * sending the error.
+ */
+ if (!uuid_compare (probe_req.uuid, MY_UUID)) {
+ gf_log (THIS->name, GF_LOG_ERROR, "Peer uuid %s is same as "
+ "local uuid. Please check the uuid of both the peers "
+ "from %s/%s", uuid_utoa (probe_req.uuid),
+ GLUSTERD_DEFAULT_WORKDIR, GLUSTERD_INFO_FILE);
+ rsp.op_ret = -1;
+ rsp.op_errno = GF_PROBE_SAME_UUID;
+ rsp.port = port;
+ goto respond;
+ }
+
ret = glusterd_remote_hostname_get (req, remote_hostname,
sizeof (remote_hostname));
if (ret) {
@@ -1777,6 +1791,7 @@ glusterd_handle_probe_query (rpcsvc_request_t *req)
}
}
+respond:
uuid_copy (rsp.uuid, conf->uuid);
rsp.hostname = probe_req.hostname;