diff options
author | Avra Sengupta <asengupt@redhat.com> | 2013-10-30 12:17:53 +0530 |
---|---|---|
committer | Avra Sengupta <asengupt@redhat.com> | 2013-10-31 16:31:06 +0530 |
commit | ecdc539754d4b3a5ed5a898f4b4a3387fef6dd9f (patch) | |
tree | 00a143be8edc50c7d4f3a09386285b15e1b70c69 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | a7799add58c565c7fa8840edda0784e7d5701d49 (diff) |
glusterd/Jarvis: Added aggr rsp dict in jarvis framework
Also fixes snapshot config output
Change-Id: Ia50d94492009cf73dbb99ba20117b9fa4c41048a
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index cc504d5d4..0f50a39b9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -7370,6 +7370,88 @@ out: } int +glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src) +{ + int ret = -1; + uint64_t limit = 0; + int config_command = 0; + + if (!dst || !src) { + gf_log ("", GF_LOG_ERROR, "Source or Destination " + "dict is empty."); + goto out; + } + + ret = dict_get_int32 (dst, "config-command", &config_command); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "failed to get config-command type"); + goto out; + } + + switch (config_command) { + case GF_SNAP_CONFIG_DISPLAY: + ret = dict_get_uint64 (src, "limit", &limit); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to fetch limit"); + goto out; + } + + ret = dict_set_uint64 (dst, "limit", limit); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to set limit"); + goto out; + } + + break; + default: + break; + } + + ret = 0; +out: + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + return ret; +} + +int +glusterd_snap_use_rsp_dict (dict_t *dst, dict_t *src) +{ + int ret = -1; + int32_t snap_command = 0; + + if (!dst || !src) { + gf_log ("", GF_LOG_ERROR, "Source or Destination " + "dict is empty."); + goto out; + } + + ret = dict_get_int32 (dst, "type", &snap_command); + if (ret) { + gf_log ("", GF_LOG_ERROR, "unable to get the type of " + "the snapshot command"); + goto out; + } + + switch (snap_command) { + case GF_SNAP_OPTION_TYPE_CONFIG: + ret = glusterd_snap_config_use_rsp_dict (dst, src); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to use rsp dict"); + goto out; + } + break; + default: + break; + } + + ret = 0; +out: + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + return ret; +} + +int glusterd_sys_exec_output_rsp_dict (dict_t *dst, dict_t *src) { char output_name[PATH_MAX] = ""; |