summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-07-20 14:53:04 +0530
committerAnand Avati <avati@gluster.com>2011-07-20 06:11:52 -0700
commita7e38564ec859afc15274a0d9a16d6e04ed3f6e2 (patch)
tree05ae800c078bb3b290656278bdc8898cc1066df1 /xlators/mgmt/glusterd/src
parent46afd33ebe184604443a695ebf8eaea8c2098443 (diff)
Top/Profile: Report error when all bricks are down on volume
Profile - If all bricks are down, report errror. Top - If all bricks or the specified brick is down, report error. Change-Id: I39d4acd631b481233ab2e9f66c8f4160caef5762 BUG: 2600 Reviewed-on: http://review.gluster.com/63 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 83f64bf9d26..e5aa156e1c1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -7922,6 +7922,7 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
glusterd_brickinfo_t *brickinfo = NULL;
glusterd_pending_node_t *pending_node = NULL;
char *brick = NULL;
+ int all_bricks_down = 0;
this = THIS;
GF_ASSERT (this);
@@ -7956,8 +7957,10 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
goto out;
break;
case GF_CLI_STATS_INFO:
+ all_bricks_down = 1;
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (glusterd_is_brick_started (brickinfo)) {
+ all_bricks_down = 0;
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
if (!pending_node) {
@@ -7974,6 +7977,7 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
break;
case GF_CLI_STATS_TOP:
+ all_bricks_down = 1;
ret = dict_get_str (dict, "brick", &brick);
if (!ret) {
ret = glusterd_volume_brickinfo_get_by_brick (brick,
@@ -7981,6 +7985,13 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
if (ret)
goto out;
+ if (!glusterd_is_brick_started (brickinfo)) {
+ ret = -1;
+ goto out;
+ } else {
+ all_bricks_down = 0;
+ }
+
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
if (!pending_node) {
@@ -7997,6 +8008,7 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
ret = 0;
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (glusterd_is_brick_started (brickinfo)) {
+ all_bricks_down = 0;
pending_node = GF_CALLOC (1, sizeof (*pending_node),
gf_gld_mt_pending_node_t);
if (!pending_node) {
@@ -8023,6 +8035,10 @@ glusterd_bricks_select_profile_volume (dict_t *dict, char **op_errstr)
out:
+ if (all_bricks_down) {
+ ret = -1;
+ *op_errstr = gf_strdup ("Cannot reach bricks. Bricks are down");
+ }
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;