|
|
3604df |
From c37f00c27cd27364896400704963737bb6c90668 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Samikshan Bairagya <samikshan@gmail.com>
|
|
|
3604df |
Date: Thu, 13 Oct 2016 17:13:54 +0530
|
|
|
3604df |
Subject: [PATCH 135/141] cli, glusterd: Address issues in get-state cli output
|
|
|
3604df |
|
|
|
3604df |
This fixes the following data points:
|
|
|
3604df |
1. Volume type
|
|
|
3604df |
2. Peer state
|
|
|
3604df |
3. List of other hostnames for a peer
|
|
|
3604df |
4. Data unit information for rebalance
|
|
|
3604df |
|
|
|
3604df |
The following data points are removed:
|
|
|
3604df |
1. Mount options and filesystem types for bricks
|
|
|
3604df |
2. global-option-version from list of global options
|
|
|
3604df |
|
|
|
3604df |
The following data points are added:
|
|
|
3604df |
1. Replica Count
|
|
|
3604df |
2. Tier type for bricks belonging to hot/cold tier
|
|
|
3604df |
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/15662
|
|
|
3604df |
> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com>
|
|
|
3604df |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15696
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I5011250e863fdc4929b203cdb345d79b2f16c6a5
|
|
|
3604df |
BUG: 1382277
|
|
|
3604df |
Signed-off-by: Samikshan Bairagya <samikshan@gmail.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87965
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-handler.c | 57 +++++++++++++---------
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-peer-utils.c | 51 --------------------
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-peer-utils.h | 3 -
|
|
|
3604df |
xlators/mgmt/glusterd/src/glusterd-utils.c | 4 +-
|
|
|
3604df |
4 files changed, 36 insertions(+), 79 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
3604df |
index d81204e..d2bb20d 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
3604df |
@@ -4957,6 +4957,9 @@ glusterd_print_global_options (dict_t *opts, char *key, data_t *val, void *data)
|
|
|
3604df |
GF_VALIDATE_OR_GOTO (THIS->name, val, out);
|
|
|
3604df |
GF_VALIDATE_OR_GOTO (THIS->name, data, out);
|
|
|
3604df |
|
|
|
3604df |
+ if (strcmp (key, "global-option-version") == 0)
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+
|
|
|
3604df |
fp = (FILE *) data;
|
|
|
3604df |
fprintf (fp, "%s: %s\n", key, val->data);
|
|
|
3604df |
out:
|
|
|
3604df |
@@ -5045,7 +5048,6 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
|
|
|
3604df |
char transport_type_str[STATUS_STRLEN] = {0,};
|
|
|
3604df |
char quorum_status_str[STATUS_STRLEN] = {0,};
|
|
|
3604df |
char rebal_status_str[STATUS_STRLEN] = {0,};
|
|
|
3604df |
- char peer_state_str[STATUS_STRLEN] = {0,};
|
|
|
3604df |
char vol_status_str[STATUS_STRLEN] = {0,};
|
|
|
3604df |
|
|
|
3604df |
this = THIS;
|
|
|
3604df |
@@ -5133,25 +5135,29 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
|
|
|
3604df |
fprintf (fp, "\n[Peers]\n");
|
|
|
3604df |
|
|
|
3604df |
cds_list_for_each_entry_rcu (peerinfo, &priv->peers, uuid_list) {
|
|
|
3604df |
- ret = gd_peer_state_str (peerinfo, peer_state_str);
|
|
|
3604df |
- if (ret) {
|
|
|
3604df |
- rcu_read_unlock ();
|
|
|
3604df |
- gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
3604df |
- GD_MSG_STATE_STR_GET_FAILED,
|
|
|
3604df |
- "Failed to get peer state");
|
|
|
3604df |
- goto out;
|
|
|
3604df |
- }
|
|
|
3604df |
-
|
|
|
3604df |
fprintf (fp, "Peer%d.primary_hostname: %s\n", ++count,
|
|
|
3604df |
peerinfo->hostname);
|
|
|
3604df |
fprintf (fp, "Peer%d.uuid: %s\n", count, gd_peer_uuid_str (peerinfo));
|
|
|
3604df |
- fprintf (fp, "Peer%d.state: %s\n", count, peer_state_str);
|
|
|
3604df |
- fprintf (fp, "Peer%d.connected: %d\n", count, peerinfo->connected);
|
|
|
3604df |
+ fprintf (fp, "Peer%d.state: %s\n", count,
|
|
|
3604df |
+ glusterd_friend_sm_state_name_get (peerinfo->state.state));
|
|
|
3604df |
+ fprintf (fp, "Peer%d.connected: %s\n", count,
|
|
|
3604df |
+ peerinfo->connected ? "Connected" : "Disconnected");
|
|
|
3604df |
|
|
|
3604df |
- fprintf (fp, "Peer%d.hostnames: ", count);
|
|
|
3604df |
+ fprintf (fp, "Peer%d.othernames: ", count);
|
|
|
3604df |
+ count_bkp = 0;
|
|
|
3604df |
cds_list_for_each_entry (peer_hostname_info,
|
|
|
3604df |
- &peerinfo->hostnames, hostname_list)
|
|
|
3604df |
- fprintf (fp, "%s, ", peer_hostname_info->hostname);
|
|
|
3604df |
+ &peerinfo->hostnames, hostname_list) {
|
|
|
3604df |
+ if (strcmp (peerinfo->hostname,
|
|
|
3604df |
+ peer_hostname_info->hostname) == 0)
|
|
|
3604df |
+ continue;
|
|
|
3604df |
+
|
|
|
3604df |
+ if (count_bkp > 0)
|
|
|
3604df |
+ fprintf (fp, ",");
|
|
|
3604df |
+
|
|
|
3604df |
+ fprintf (fp, "%s", peer_hostname_info->hostname);
|
|
|
3604df |
+ count_bkp++;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ count_bkp = 0;
|
|
|
3604df |
fprintf (fp, "\n");
|
|
|
3604df |
}
|
|
|
3604df |
rcu_read_unlock ();
|
|
|
3604df |
@@ -5237,12 +5243,17 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
|
|
|
3604df |
count, brickinfo->rdma_port);
|
|
|
3604df |
fprintf (fp, "Volume%d.Brick%d.status: %s\n", count_bkp,
|
|
|
3604df |
count, brickinfo->status ? "Started" : "Stopped");
|
|
|
3604df |
- fprintf (fp, "Volume%d.Brick%d.filesystem_type: %s\n",
|
|
|
3604df |
- count_bkp, count, brickinfo->fstype);
|
|
|
3604df |
- fprintf (fp, "Volume%d.Brick%d.mount_options: %s\n",
|
|
|
3604df |
- count_bkp, count, brickinfo->mnt_opts);
|
|
|
3604df |
fprintf (fp, "Volume%d.Brick%d.signedin: %s\n", count_bkp,
|
|
|
3604df |
count, brickinfo->signed_in ? "True" : "False");
|
|
|
3604df |
+
|
|
|
3604df |
+ /*FIXME: This is a hacky way of figuring out whether a
|
|
|
3604df |
+ * brick belongs to the hot or cold tier */
|
|
|
3604df |
+ if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
|
|
|
3604df |
+ fprintf (fp, "Volume%d.Brick%d.tier: %s\n",
|
|
|
3604df |
+ count_bkp, count,
|
|
|
3604df |
+ count <= volinfo->tier_info.hot_brick_count ?
|
|
|
3604df |
+ "Hot" : "Cold");
|
|
|
3604df |
+ }
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
count = count_bkp;
|
|
|
3604df |
@@ -5255,6 +5266,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
|
|
|
3604df |
volinfo->snap_count);
|
|
|
3604df |
fprintf (fp, "Volume%d.stripe_count: %d\n", count,
|
|
|
3604df |
volinfo->stripe_count);
|
|
|
3604df |
+ fprintf (fp, "Volume%d.replica_count: %d\n", count,
|
|
|
3604df |
+ volinfo->replica_count);
|
|
|
3604df |
fprintf (fp, "Volume%d.subvol_count: %d\n", count,
|
|
|
3604df |
volinfo->subvol_count);
|
|
|
3604df |
fprintf (fp, "Volume%d.arbiter_count: %d\n", count,
|
|
|
3604df |
@@ -5283,10 +5296,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict)
|
|
|
3604df |
volinfo->rebal.lookedup_files);
|
|
|
3604df |
fprintf (fp, "Volume%d.rebalance.files: %"PRIu64"\n", count,
|
|
|
3604df |
volinfo->rebal.rebalance_files);
|
|
|
3604df |
- fprintf (fp, "Volume%d.rebalance.data: %"PRIu64"\n", count,
|
|
|
3604df |
- volinfo->rebal.rebalance_data);
|
|
|
3604df |
- fprintf (fp, "Volume%d.rebalance.data: %"PRIu64"\n", count,
|
|
|
3604df |
- volinfo->rebal.rebalance_data);
|
|
|
3604df |
+ fprintf (fp, "Volume%d.rebalance.data: %s\n", count,
|
|
|
3604df |
+ gf_uint64_2human_readable (volinfo->rebal.rebalance_data));
|
|
|
3604df |
|
|
|
3604df |
if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
|
|
|
3604df |
ret = glusterd_volume_get_hot_tier_type_str (
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
3604df |
index 509efb7..72d6b17 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
|
|
|
3604df |
@@ -393,57 +393,6 @@ gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo)
|
|
|
3604df |
return peerinfo->uuid_str;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
-int
|
|
|
3604df |
-gd_peer_state_str (glusterd_peerinfo_t *peerinfo, char *state_str)
|
|
|
3604df |
-{
|
|
|
3604df |
- int ret = -1;
|
|
|
3604df |
-
|
|
|
3604df |
- GF_VALIDATE_OR_GOTO (THIS->name, peerinfo, out);
|
|
|
3604df |
- GF_VALIDATE_OR_GOTO (THIS->name, state_str, out);
|
|
|
3604df |
-
|
|
|
3604df |
- switch (peerinfo->state.state) {
|
|
|
3604df |
- case GD_FRIEND_STATE_DEFAULT:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "default");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_REQ_SENT:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "request sent");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_REQ_RCVD:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "request received");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_BEFRIENDED:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "befriended");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_REQ_ACCEPTED:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "request accepted");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_REQ_SENT_RCVD:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "request sent received");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_REJECTED:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "rejected");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_UNFRIEND_SENT:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "unfriend sent");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_PROBE_RCVD:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "probe received");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_CONNECTED_RCVD:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "connected received");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_CONNECTED_ACCEPTED:
|
|
|
3604df |
- gf_asprintf (&state_str, "%s", "connected accepted");
|
|
|
3604df |
- break;
|
|
|
3604df |
- case GD_FRIEND_STATE_MAX:
|
|
|
3604df |
- goto out;
|
|
|
3604df |
- }
|
|
|
3604df |
-
|
|
|
3604df |
- ret = 0;
|
|
|
3604df |
-out:
|
|
|
3604df |
- return ret;
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
gf_boolean_t
|
|
|
3604df |
glusterd_are_all_peers_up ()
|
|
|
3604df |
{
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
|
|
|
3604df |
index ee78b03..9332cf2 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h
|
|
|
3604df |
@@ -42,9 +42,6 @@ glusterd_uuid_to_hostname (uuid_t uuid);
|
|
|
3604df |
char*
|
|
|
3604df |
gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo);
|
|
|
3604df |
|
|
|
3604df |
-int
|
|
|
3604df |
-gd_peer_state_str (glusterd_peerinfo_t *peerinfo, char *state_str);
|
|
|
3604df |
-
|
|
|
3604df |
gf_boolean_t
|
|
|
3604df |
glusterd_are_all_peers_up ();
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
3604df |
index dd8766b..df0c0ab 100644
|
|
|
3604df |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
3604df |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
3604df |
@@ -11244,8 +11244,8 @@ glusterd_volume_get_type_str (glusterd_volinfo_t *volinfo, char **voltype_str)
|
|
|
3604df |
|
|
|
3604df |
GF_VALIDATE_OR_GOTO (THIS->name, volinfo, out);
|
|
|
3604df |
|
|
|
3604df |
- type = get_vol_type (volinfo->type, volinfo->brick_count,
|
|
|
3604df |
- volinfo->dist_leaf_count);
|
|
|
3604df |
+ type = get_vol_type (volinfo->type, volinfo->dist_leaf_count,
|
|
|
3604df |
+ volinfo->brick_count);
|
|
|
3604df |
|
|
|
3604df |
*voltype_str = vol_type_str[type];
|
|
|
3604df |
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|