diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 57 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-peer-utils.c | 51 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-peer-utils.h | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 |
4 files changed, 36 insertions, 79 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 3824e6d1ba3..50649795f70 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -4951,6 +4951,9 @@ glusterd_print_global_options (dict_t *opts, char *key, data_t *val, void *data) GF_VALIDATE_OR_GOTO (THIS->name, val, out); GF_VALIDATE_OR_GOTO (THIS->name, data, out); + if (strcmp (key, "global-option-version") == 0) + goto out; + fp = (FILE *) data; fprintf (fp, "%s: %s\n", key, val->data); out: @@ -5037,7 +5040,6 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) char transport_type_str[STATUS_STRLEN] = {0,}; char quorum_status_str[STATUS_STRLEN] = {0,}; char rebal_status_str[STATUS_STRLEN] = {0,}; - char peer_state_str[STATUS_STRLEN] = {0,}; char vol_status_str[STATUS_STRLEN] = {0,}; this = THIS; @@ -5125,25 +5127,29 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) fprintf (fp, "\n[Peers]\n"); cds_list_for_each_entry_rcu (peerinfo, &priv->peers, uuid_list) { - ret = gd_peer_state_str (peerinfo, peer_state_str); - if (ret) { - rcu_read_unlock (); - gf_msg (this->name, GF_LOG_ERROR, 0, - GD_MSG_STATE_STR_GET_FAILED, - "Failed to get peer state"); - goto out; - } - fprintf (fp, "Peer%d.primary_hostname: %s\n", ++count, peerinfo->hostname); fprintf (fp, "Peer%d.uuid: %s\n", count, gd_peer_uuid_str (peerinfo)); - fprintf (fp, "Peer%d.state: %s\n", count, peer_state_str); - fprintf (fp, "Peer%d.connected: %d\n", count, peerinfo->connected); + fprintf (fp, "Peer%d.state: %s\n", count, + glusterd_friend_sm_state_name_get (peerinfo->state.state)); + fprintf (fp, "Peer%d.connected: %s\n", count, + peerinfo->connected ? "Connected" : "Disconnected"); - fprintf (fp, "Peer%d.hostnames: ", count); + fprintf (fp, "Peer%d.othernames: ", count); + count_bkp = 0; cds_list_for_each_entry (peer_hostname_info, - &peerinfo->hostnames, hostname_list) - fprintf (fp, "%s, ", peer_hostname_info->hostname); + &peerinfo->hostnames, hostname_list) { + if (strcmp (peerinfo->hostname, + peer_hostname_info->hostname) == 0) + continue; + + if (count_bkp > 0) + fprintf (fp, ","); + + fprintf (fp, "%s", peer_hostname_info->hostname); + count_bkp++; + } + count_bkp = 0; fprintf (fp, "\n"); } rcu_read_unlock (); @@ -5229,12 +5235,17 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) count, brickinfo->rdma_port); fprintf (fp, "Volume%d.Brick%d.status: %s\n", count_bkp, count, brickinfo->status ? "Started" : "Stopped"); - fprintf (fp, "Volume%d.Brick%d.filesystem_type: %s\n", - count_bkp, count, brickinfo->fstype); - fprintf (fp, "Volume%d.Brick%d.mount_options: %s\n", - count_bkp, count, brickinfo->mnt_opts); fprintf (fp, "Volume%d.Brick%d.signedin: %s\n", count_bkp, count, brickinfo->signed_in ? "True" : "False"); + + /*FIXME: This is a hacky way of figuring out whether a + * brick belongs to the hot or cold tier */ + if (volinfo->type == GF_CLUSTER_TYPE_TIER) { + fprintf (fp, "Volume%d.Brick%d.tier: %s\n", + count_bkp, count, + count <= volinfo->tier_info.hot_brick_count ? + "Hot" : "Cold"); + } } count = count_bkp; @@ -5247,6 +5258,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) volinfo->snap_count); fprintf (fp, "Volume%d.stripe_count: %d\n", count, volinfo->stripe_count); + fprintf (fp, "Volume%d.replica_count: %d\n", count, + volinfo->replica_count); fprintf (fp, "Volume%d.subvol_count: %d\n", count, volinfo->subvol_count); fprintf (fp, "Volume%d.arbiter_count: %d\n", count, @@ -5275,10 +5288,8 @@ glusterd_get_state (rpcsvc_request_t *req, dict_t *dict) volinfo->rebal.lookedup_files); fprintf (fp, "Volume%d.rebalance.files: %"PRIu64"\n", count, volinfo->rebal.rebalance_files); - fprintf (fp, "Volume%d.rebalance.data: %"PRIu64"\n", count, - volinfo->rebal.rebalance_data); - fprintf (fp, "Volume%d.rebalance.data: %"PRIu64"\n", count, - volinfo->rebal.rebalance_data); + fprintf (fp, "Volume%d.rebalance.data: %s\n", count, + gf_uint64_2human_readable (volinfo->rebal.rebalance_data)); if (volinfo->type == GF_CLUSTER_TYPE_TIER) { ret = glusterd_volume_get_hot_tier_type_str ( diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c index c310ec8ddff..31f9e873563 100644 --- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c @@ -392,57 +392,6 @@ gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo) return peerinfo->uuid_str; } -int -gd_peer_state_str (glusterd_peerinfo_t *peerinfo, char *state_str) -{ - int ret = -1; - - GF_VALIDATE_OR_GOTO (THIS->name, peerinfo, out); - GF_VALIDATE_OR_GOTO (THIS->name, state_str, out); - - switch (peerinfo->state.state) { - case GD_FRIEND_STATE_DEFAULT: - gf_asprintf (&state_str, "%s", "default"); - break; - case GD_FRIEND_STATE_REQ_SENT: - gf_asprintf (&state_str, "%s", "request sent"); - break; - case GD_FRIEND_STATE_REQ_RCVD: - gf_asprintf (&state_str, "%s", "request received"); - break; - case GD_FRIEND_STATE_BEFRIENDED: - gf_asprintf (&state_str, "%s", "befriended"); - break; - case GD_FRIEND_STATE_REQ_ACCEPTED: - gf_asprintf (&state_str, "%s", "request accepted"); - break; - case GD_FRIEND_STATE_REQ_SENT_RCVD: - gf_asprintf (&state_str, "%s", "request sent received"); - break; - case GD_FRIEND_STATE_REJECTED: - gf_asprintf (&state_str, "%s", "rejected"); - break; - case GD_FRIEND_STATE_UNFRIEND_SENT: - gf_asprintf (&state_str, "%s", "unfriend sent"); - break; - case GD_FRIEND_STATE_PROBE_RCVD: - gf_asprintf (&state_str, "%s", "probe received"); - break; - case GD_FRIEND_STATE_CONNECTED_RCVD: - gf_asprintf (&state_str, "%s", "connected received"); - break; - case GD_FRIEND_STATE_CONNECTED_ACCEPTED: - gf_asprintf (&state_str, "%s", "connected accepted"); - break; - case GD_FRIEND_STATE_MAX: - goto out; - } - - ret = 0; -out: - return ret; -} - gf_boolean_t glusterd_are_all_peers_up () { diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h index e500ee1dd91..e74d1ed9536 100644 --- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.h @@ -42,9 +42,6 @@ glusterd_uuid_to_hostname (uuid_t uuid); char* gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo); -int -gd_peer_state_str (glusterd_peerinfo_t *peerinfo, char *state_str); - gf_boolean_t glusterd_are_all_peers_up (); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 5b02a321c42..48232ffdaa8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -11207,8 +11207,8 @@ glusterd_volume_get_type_str (glusterd_volinfo_t *volinfo, char **voltype_str) GF_VALIDATE_OR_GOTO (THIS->name, volinfo, out); - type = get_vol_type (volinfo->type, volinfo->brick_count, - volinfo->dist_leaf_count); + type = get_vol_type (volinfo->type, volinfo->dist_leaf_count, + volinfo->brick_count); *voltype_str = vol_type_str[type]; |