summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2012-06-22 13:28:31 +0530
committerVijay Bellur <vbellur@redhat.com>2012-08-01 20:57:30 -0700
commit31e81065edc26378eabdd4785f5dd689719cd126 (patch)
treed2030cb65e91b98bf3aec6a8ecb97ce7e8a71319
parent84d0f889eab947b58a0f6e8d0eda5ae84c15a6c7 (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/3610 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vbellur@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 d8582aa..f313fa4 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;
@@ -1928,6 +1929,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;
@@ -1972,6 +1991,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 cdfb64d..98c901b 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -334,6 +334,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;
@@ -373,6 +375,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 b7b59fa..2fce7dc 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 e2815d8..dc93f07 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 d348a7f..ba2df52 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1404,11 +1404,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;
@@ -1480,7 +1485,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;