Blob Blame History Raw
From 34dac73cafee0cca75ad5b3c819a903b1d35420a Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Wed, 13 May 2015 14:48:42 +0530
Subject: [PATCH 52/57] glusterd : Display status of Self Heal Daemon for disperse volume

 Problem : Status of Self Heal Daemon is not
 displayed in "gluster volume status"

 As disperse volumes are self heal compatible,
 show the status of self heal daemon in gluster
 volume status command
 Review link for master -
 http://review.gluster.org/#/c/10764/

Change-Id: I83d3e6a2fd122b171f15cfd76ce8e6b6e00f92e2
BUG: 1224195
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50434
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |   38 ++++++++++++++++-----------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e304cb0..877e9ac 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -39,6 +39,7 @@
 #include "glusterd-volgen.h"
 #include "glusterd-locks.h"
 #include "glusterd-messages.h"
+#include "glusterd-utils.h"
 #include "syscall.h"
 #include "cli1-xdr.h"
 #include "common-utils.h"
@@ -50,7 +51,7 @@
 #include "glusterd-nfs-svc.h"
 #include "glusterd-quotad-svc.h"
 #include "glusterd-server-quorum.h"
-
+#include "glusterd-volgen.h"
 #include <sys/types.h>
 #include <signal.h>
 #include <sys/wait.h>
@@ -1420,13 +1421,14 @@ glusterd_op_stage_status_volume (dict_t *dict, char **op_errstr)
         char                   msg[2048]      = {0,};
         char                  *volname        = NULL;
         char                  *brick          = NULL;
+        char                  *shd_key        = NULL;
         xlator_t              *this           = NULL;
         glusterd_conf_t       *priv           = NULL;
         glusterd_brickinfo_t  *brickinfo      = NULL;
         glusterd_volinfo_t    *volinfo        = NULL;
         dict_t                *vol_opts       = NULL;
         gf_boolean_t           nfs_disabled   = _gf_false;
-        gf_boolean_t           shd_enabled    = _gf_true;
+        gf_boolean_t           shd_enabled    = _gf_false;
 
         GF_ASSERT (dict);
         this = THIS;
@@ -1498,17 +1500,18 @@ glusterd_op_stage_status_volume (dict_t *dict, char **op_errstr)
                         goto out;
                 }
         } else if ((cmd & GF_CLI_STATUS_SHD) != 0) {
-                if (!glusterd_is_volume_replicate (volinfo)) {
+                if (glusterd_is_shd_compatible_volume (volinfo)) {
+                        shd_key = volgen_get_shd_key(volinfo);
+                        shd_enabled = dict_get_str_boolean (vol_opts,
+                                                     shd_key,
+                                                     _gf_true);
+                } else {
                         ret = -1;
                         snprintf (msg, sizeof (msg),
-                                  "Volume %s is not of type replicate",
-                                  volname);
+                              "Volume %s is not Self-heal compatible",
+                              volname);
                         goto out;
                 }
-
-                shd_enabled = dict_get_str_boolean (vol_opts,
-                                                    "cluster.self-heal-daemon",
-                                                    _gf_true);
                 if (!shd_enabled) {
                         ret = -1;
                         snprintf (msg, sizeof (msg),
@@ -2869,13 +2872,14 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
         uint32_t                cmd             = 0;
         char                   *volname         = NULL;
         char                   *brick           = NULL;
+        char                   *shd_key         = NULL;
         xlator_t               *this            = NULL;
         glusterd_volinfo_t     *volinfo         = NULL;
         glusterd_brickinfo_t   *brickinfo       = NULL;
         glusterd_conf_t        *priv            = NULL;
         dict_t                 *vol_opts        = NULL;
         gf_boolean_t            nfs_disabled    = _gf_false;
-        gf_boolean_t            shd_enabled     = _gf_true;
+        gf_boolean_t            shd_enabled     = _gf_false;
         gf_boolean_t            origin_glusterd = _gf_false;
 
         this = THIS;
@@ -3039,12 +3043,13 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
                                 other_count++;
                                 node_count++;
                         }
-
-                        shd_enabled = dict_get_str_boolean
-                                        (vol_opts, "cluster.self-heal-daemon",
-                                         _gf_true);
-                        if (glusterd_is_volume_replicate (volinfo)
-                            && shd_enabled) {
+                        if (glusterd_is_shd_compatible_volume (volinfo)) {
+                                shd_key = volgen_get_shd_key (volinfo);
+                                shd_enabled = dict_get_str_boolean (vol_opts,
+                                                     shd_key,
+                                                     _gf_true);
+                        }
+                        if (shd_enabled) {
                                 ret = glusterd_add_node_to_dict
                                         (priv->shd_svc.name, rsp_dict,
                                          other_index, vol_opts);
@@ -3054,6 +3059,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
                                 node_count++;
                                 other_index++;
                         }
+
                         if (glusterd_is_volume_quota_enabled (volinfo)) {
                                 ret = glusterd_add_node_to_dict
                                                         (priv->quotad_svc.name,
-- 
1.7.1