diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2012-09-27 00:49:54 +0530 |
---|---|---|
committer | Pranith Kumar K <pkarampu@redhat.com> | 2012-09-27 10:41:19 +0530 |
commit | 13cfed388a19dd70984197fb14330d0277ba91e7 (patch) | |
tree | 8e86f3cc4f441b3804741ee9dc6dbb9288269b12 /cli/src | |
parent | c8f9437b6ef507a4dc7fe03aa32a9fbf220d09f6 (diff) |
mgmt/glusterd: Implementation of server-side quorum.
Feature-page:
http://www.gluster.org/community/documentation/index.php/Features/Server-quorum
Change-Id: Ifec0f1a697d390a29ba447a09750602fea1b3a4b
BUG: 840122
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index dad863cd815..28cd3f7d2d0 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -90,6 +90,38 @@ 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_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_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) @@ -136,39 +168,7 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, } if (rsp.op_ret) { - 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; - - default: - snprintf (msg, sizeof (msg), - "Probe unsuccessful\nProbe returned " - "with unknown errno %d", - rsp.op_errno); - break; - } + gf_cli_probe_strerror (&rsp, msg, sizeof (msg)); gf_log ("glusterd",GF_LOG_ERROR,"Probe failed with op_ret %d" " and op_errno %d", rsp.op_ret, rsp.op_errno); } @@ -237,6 +237,12 @@ gf_cli3_1_deprobe_cbk (struct rpc_req *req, struct iovec *iov, "One of the peers is probably 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 unsuccessful\nDetach returned" |