From 096b23f187d0b3ccbed25d8bd02723a61cc4da2d Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 24 Oct 2013 15:47:14 +0530 Subject: mgmt/glusterd: snapshot config changes Also refactored code in glusterd for create command Additionally, removed brick-op func from mgmt_iniate_all_phases Change-Id: Iddcc332009c5716adee7f2b04c93b352fb983446 Signed-off-by: shishir gowda --- cli/src/cli-rpc-ops.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'cli/src/cli-rpc-ops.c') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 20cad3bb3..e881e18fc 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -7806,6 +7806,9 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov, int32_t type = 0; int64_t volcount = -1; call_frame_t *frame = NULL; + uint64_t limit = 0; + int32_t config_command = 0; + char *volname = NULL; if (req->rpc_status == -1) { ret = -1; @@ -7903,6 +7906,52 @@ gf_cli_snapshot_cbk (struct rpc_req *req, struct iovec *iov, } break; + case GF_SNAP_OPTION_TYPE_CONFIG: + if (rsp.op_ret) { + cli_err ("Snapshot Config : failed: %s", + rsp.op_errstr ? rsp.op_errstr : + "Please check log file for details"); + ret = rsp.op_ret; + goto out; + } + + ret = dict_get_int32 (dict, "config-command", &config_command); + + if (ret) { + gf_log("", GF_LOG_DEBUG, "Could not fetch config type"); + ret = -1; + goto out; + } + + ret = dict_get_str (dict, "volname", &volname); + if (ret) { + gf_log("", GF_LOG_DEBUG, "Could not fetch " + "volname"); + ret = -1; + goto out; + } + + if (!strcmp (volname, "all")) { + volname = "System"; + } + + if (config_command == GF_SNAP_CONFIG_DISPLAY) { + + ret = dict_get_uint64 (dict, "limit", &limit); + if (ret) { + gf_log("", GF_LOG_DEBUG, "Could not fetch " + "limit for %s", volname); + ret = -1; + goto out; + } + cli_out ("Max snapshot count set for %s is %"PRIu64, + volname, limit); + } else { + cli_out ("Snapshot config max set for %s successfull", + volname); + } + break; + default: cli_err ("Unknown command executed"); ret = -1; -- cgit