summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-04-24 10:27:18 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-25 04:05:35 -0700
commit8f2eba00fd315b42aeaa01d683b765fbd2ee111b (patch)
tree18ef5e7b1aa828fce4e2a2c8fa1dfdc54e8d35c0 /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent3f35280a364bd35293d3e5804eb2a659a7f174b1 (diff)
rebalance: handshake_event_notify to make fsd talk to glusterd
Event_notify can be used by others to communicate with glusterd. A cbk event is also added for future use. req has a op, and dict. rsp has op_ret, op_errno, and dict. With this, rebalance process can update the status before exiting. Signed-off-by: shishir gowda <shishirng@gluster.com> Change-Id: If5c0ec00514eb3a109a790b2ea273317611e4562 BUG: 807126 Reviewed-on: http://review.gluster.com/3013 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c50
1 files changed, 5 insertions, 45 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 80976f2ca20..3b6f679edb4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -3253,7 +3253,6 @@ out:
return ret;
}
-
int
glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
dict_t *op_ctx)
@@ -3261,16 +3260,11 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
int ret = 0;
char *volname = NULL;
glusterd_volinfo_t *volinfo = NULL;
- uint64_t files = 0;
- uint64_t size = 0;
- uint64_t lookup = 0;
- gf_defrag_status_t status = GF_DEFRAG_STATUS_NOT_STARTED;
char key[256] = {0,};
int32_t i = 0;
char buf[1024] = {0,};
char *node_str = NULL;
glusterd_conf_t *priv = NULL;
- uint64_t failures = 0;
priv = THIS->private;
GF_ASSERT (req_dict);
@@ -3286,48 +3280,16 @@ glusterd_defrag_volume_node_rsp (dict_t *req_dict, dict_t *rsp_dict,
if (ret)
goto out;
- if (!rsp_dict)
- goto populate;
-
- ret = dict_get_uint64 (rsp_dict, "files", &files);
- if (ret)
- gf_log (THIS->name, GF_LOG_TRACE,
- "failed to get file count");
-
- ret = dict_get_uint64 (rsp_dict, "size", &size);
- if (ret)
- gf_log (THIS->name, GF_LOG_TRACE,
- "failed to get size of xfer");
-
- ret = dict_get_uint64 (rsp_dict, "lookups", &lookup);
- if (ret)
- gf_log (THIS->name, GF_LOG_TRACE,
- "failed to get lookedup file count");
- ret = dict_get_int32 (rsp_dict, "status", (int32_t *)&status);
- if (ret)
- gf_log (THIS->name, GF_LOG_TRACE,
- "failed to get status");
-
- ret = dict_get_uint64 (rsp_dict, "failures", &failures);
- if (ret)
- gf_log (THIS->name, GF_LOG_TRACE,
- "failed to get failure count");
-
- if (files)
- volinfo->rebalance_files = files;
- if (size)
- volinfo->rebalance_data = size;
- if (lookup)
- volinfo->lookedup_files = lookup;
- if (failures)
- volinfo->rebalance_failures = failures;
+ if (rsp_dict) {
+ ret = glusterd_defrag_volume_status_update (volinfo,
+ rsp_dict);
+ }
if (!op_ctx) {
dict_copy (rsp_dict, op_ctx);
goto out;
}
-populate:
ret = dict_get_int32 (op_ctx, "count", &i);
i++;
@@ -3364,12 +3326,10 @@ populate:
if (ret)
gf_log (THIS->name, GF_LOG_ERROR,
"failed to set lookedup file count");
- if (!status)
- status = volinfo->defrag_status;
memset (key, 0 , 256);
snprintf (key, 256, "status-%d", i);
- ret = dict_set_int32 (op_ctx, key, status);
+ ret = dict_set_int32 (op_ctx, key, volinfo->defrag_status);
if (ret)
gf_log (THIS->name, GF_LOG_ERROR,
"failed to set status");