summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-11-06 12:18:24 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-23 23:14:50 -0800
commit7c23a94516c5dd21536c259f323a3cc113fdfa0d (patch)
tree36c0efc8a3bbd4976ae56d8e5fff1cccbcef9c93 /cli
parent76a4afec6e03d15cb442e819f6fe7b94d6f9f487 (diff)
mgmt/glusterd: Implementation of server-side quorum
Feature-page: http://www.gluster.org/community/documentation/index.php/Features/Server-quorum Change-Id: I747b222519e71022462343d2c1bcd3626e1f9c86 BUG: 839595 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.org/3811 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c84
1 files changed, 43 insertions, 41 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 44202037169..10ff6e7a90e 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -83,6 +83,42 @@ rpc_clnt_prog_t cli_pmap_prog = {
.progver = GLUSTER_PMAP_VERSION,
};
+void
+gf_cli_probe_strerror (gf1_cli_probe_rsp *rsp, char *msg, size_t len)
+{
+ switch (rsp->op_errno) {
+ case GF_PROBE_ANOTHER_CLUSTER:
+ snprintf (msg, len, "%s is already part of another cluster",
+ rsp->hostname);
+ break;
+ case GF_PROBE_VOLUME_CONFLICT:
+ snprintf (msg, len, "Atleast one volume on %s conflicts with "
+ "existing volumes in the cluster", rsp->hostname);
+ break;
+ case GF_PROBE_UNKNOWN_PEER:
+ snprintf (msg, len, "%s responded with 'unknown peer' error, "
+ "this could happen if %s doesn't have localhost in "
+ "its peer database", rsp->hostname, rsp->hostname);
+ break;
+ case GF_PROBE_ADD_FAILED:
+ snprintf (msg, len, "Failed to add peer information on %s" ,
+ rsp->hostname);
+ break;
+ case GF_PROBE_SAME_UUID:
+ snprintf (msg, len, "Peer uuid (host %s) is same as local uuid",
+ rsp->hostname);
+ break;
+ case GF_PROBE_QUORUM_NOT_MET:
+ snprintf (msg, len, "Cluster quorum is not met. Changing "
+ "peers is not allowed in this state");
+ break;
+ default:
+ snprintf (msg, len, "Probe returned with unknown "
+ "errno %d", rsp->op_errno);
+ break;
+ }
+}
+
int
gf_cli_probe_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe)
@@ -133,47 +169,7 @@ gf_cli_probe_cbk (struct rpc_req *req, struct iovec *iov,
if (rsp.op_errstr && (strlen (rsp.op_errstr) > 0)) {
snprintf (msg, sizeof (msg), "%s", rsp.op_errstr);
} else {
- switch (rsp.op_errno) {
- case GF_PROBE_ANOTHER_CLUSTER:
- snprintf (msg, sizeof (msg),
- "%s is already part of "
- "another cluster",
- rsp.hostname);
- break;
- case GF_PROBE_VOLUME_CONFLICT:
- snprintf (msg, sizeof (msg),
- "Atleast one volume on %s "
- "conflicts with existing "
- "volumes in the cluster",
- rsp.hostname);
- break;
- case GF_PROBE_UNKNOWN_PEER:
- snprintf (msg, sizeof (msg),
- "%s responded with 'unknown "
- "peer' error, this could "
- "happen if %s doesn't have "
- "localhost in its peer "
- "database", rsp.hostname,
- rsp.hostname);
- break;
- case GF_PROBE_ADD_FAILED:
- snprintf (msg, sizeof (msg),
- "Failed to add peer "
- "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 returned with unknown "
- "errno %d", rsp.op_errno);
- break;
- }
+ gf_cli_probe_strerror (&rsp, msg, sizeof (msg));
}
gf_log ("cli", GF_LOG_ERROR, "%s", msg);
}
@@ -248,6 +244,12 @@ gf_cli_deprobe_cbk (struct rpc_req *req, struct iovec *iov,
" down. Check with 'peer "
"status'.");
break;
+ case GF_DEPROBE_QUORUM_NOT_MET:
+ snprintf (msg, sizeof (msg), "Cluster "
+ "quorum is not met. Changing "
+ "peers is not allowed in this"
+ " state");
+ break;
default:
snprintf (msg, sizeof (msg),
"Detach returned with unknown"