summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2012-06-22 13:28:31 +0530
committerAnand Avati <avati@redhat.com>2012-06-29 17:25:46 -0700
commit5a5148f07a808d1b94a116eb41a9452bd58ed6bb (patch)
tree158b9db246d14799e813ff19650de98b4b1ba15a
parent5672e77d3102a990a2aa11e7e56ebfe6a0eee369 (diff)
cluster/dht: Remove dht dependency on glusterfsd-mgmt
glusterfs_ctx->notify can be used by any xlator to talk to glusterfsd-mgmt. Note- This is for any rpc communication initiated by the xlator, and not from glusterd. Change-Id: Ic0e4af106fe1e98d797ca621facda8839b87598a BUG: 835757 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.com/3618 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c21
-rw-r--r--libglusterfs/src/glusterfs.h4
-rw-r--r--libglusterfs/src/xlator.h5
-rw-r--r--rpc/rpc-lib/src/protocol-common.h5
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c8
5 files changed, 36 insertions, 7 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 6122a76a3..9984b42bb 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -47,6 +47,7 @@
#include "cli1-xdr.h"
#include "statedump.h"
#include "syncop.h"
+#include "xlator.h"
static char is_mgmt_rpc_reconnect;
@@ -1937,6 +1938,24 @@ glusterfs_listener_stop (glusterfs_ctx_t *ctx)
}
int
+glusterfs_mgmt_notify (int32_t op, void *data, ...)
+{
+ int ret = 0;
+ switch (op)
+ {
+ case GF_EN_DEFRAG_STATUS:
+ ret = glusterfs_rebalance_event_notify ((dict_t*) data);
+ break;
+
+ default:
+ gf_log ("", GF_LOG_ERROR, "Invalid op");
+ break;
+ }
+
+ return ret;
+}
+
+int
glusterfs_mgmt_init (glusterfs_ctx_t *ctx)
{
cmd_args_t *cmd_args = NULL;
@@ -1981,6 +2000,8 @@ glusterfs_mgmt_init (glusterfs_ctx_t *ctx)
goto out;
}
+ ctx->notify = glusterfs_mgmt_notify;
+
/* This value should be set before doing the 'rpc_clnt_start()' as
the notify function uses this variable */
ctx->mgmt = rpc;
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 5acefe561..780353d29 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -328,6 +328,8 @@ struct _glusterfs_graph {
typedef struct _glusterfs_graph glusterfs_graph_t;
+typedef int32_t (*glusterfsd_mgmt_event_notify_fn_t) (int32_t event, void *data,
+ ...);
struct _glusterfs_ctx {
cmd_args_t cmd_args;
char *process_uuid;
@@ -367,6 +369,8 @@ struct _glusterfs_ctx {
int mem_accounting; /* if value is other than 0, it
will be set */
+ glusterfsd_mgmt_event_notify_fn_t notify; /* Used for xlators to make
+ call to fsd-mgmt */
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index b7b59fac9..2fce7dc47 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -873,5 +873,8 @@ int is_gf_log_command (xlator_t *trans, const char *name, char *value);
int glusterd_check_log_level (const char *value);
int xlator_volopt_dynload (char *xlator_type, void **dl_handle,
volume_opt_list_t *vol_opt_handle);
-int32_t glusterfs_rebalance_event_notify (dict_t *dict);
+enum gf_hdsk_event_notify_op {
+ GF_EN_DEFRAG_STATUS,
+ GF_EN_MAX,
+};
#endif /* _XLATOR_H */
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index e2815d8c1..dc93f07dc 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -194,11 +194,6 @@ typedef enum {
GF_AFR_OP_SPLIT_BRAIN_FILES
} gf_xl_afr_op_t ;
-enum gf_hdsk_event_notify_op {
- GF_EN_DEFRAG_STATUS,
- GF_EN_MAX,
-};
-
#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */
#define GLUSTER_HNDSK_VERSION 2 /* 0.0.1 */
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 88c84dd37..d2a59cc43 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1427,11 +1427,16 @@ gf_defrag_start_crawl (void *data)
dict_t *fix_layout = NULL;
dict_t *migrate_data = NULL;
dict_t *status = NULL;
+ glusterfs_ctx_t *ctx = NULL;
this = data;
if (!this)
goto out;
+ ctx = glusterfs_ctx_get ();
+ if (!ctx)
+ goto out;
+
conf = this->private;
if (!conf)
goto out;
@@ -1505,7 +1510,8 @@ out:
{
status = dict_new ();
gf_defrag_status_get (defrag, status);
- glusterfs_rebalance_event_notify (status);
+ if (ctx->notify)
+ ctx->notify (GF_EN_DEFRAG_STATUS, status);
if (status)
dict_unref (status);
defrag->is_exiting = 1;