diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2013-10-16 18:18:04 +0530 |
---|---|---|
committer | shishir gowda <sgowda@redhat.com> | 2013-11-15 12:38:59 +0530 |
commit | cc4fa72926f9ac517365d91ae6144530dc67c001 (patch) | |
tree | 9da64c3ceeda354726be21c6df118f2ce6616b5c /xlators/mgmt/glusterd/src/glusterd-mgmt.c | |
parent | d15ad38e8623f510fb1e121a8ff0d845a99238e4 (diff) |
mgmt/glusterd: snapshot create command
This is still a work in progress.
As of now, these things are done:
* Take the snapshot of the backend brick
* Create the new volume for the snapshot
* Create the brick and the client volfiles
* Store the snapshot related info in /var/lib/glusterd
* Create the snap object representing the snapshot
TODO:
Start the brick processes for the snapshot
Change-Id: I26fbb0f8e5cf004d4c1dbca51819bab1cd1bac15
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 268a834d8..764838b76 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -119,7 +119,17 @@ gd_mgmt_v3_pre_validate_fn (glusterd_op_t op, dict_t *dict, int ret = -1; xlator_t *this = THIS; - ret = 0; + switch (op) { + case GD_OP_SNAP: + { + ret = glusterd_snapshot_prevalidate (dict, op_errstr, + rsp_dict); + break; + } + default: + break; + } + gf_log (this->name, GF_LOG_DEBUG, "OP = %d. Returning %d", op, ret); return ret; } @@ -143,7 +153,20 @@ gd_mgmt_v3_commit_fn (glusterd_op_t op, dict_t *dict, int ret = -1; xlator_t *this = THIS; + switch (op) { + case GD_OP_SNAP: + { + ret = glusterd_snapshot (dict, op_errstr, rsp_dict); + if (ret) + goto out; + break; + } + default: + break; + } ret = 0; + +out: gf_log (this->name, GF_LOG_DEBUG, "OP = %d. Returning %d", op, ret); return ret; } @@ -499,11 +522,11 @@ out: } int -glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict) +glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict, + glusterd_op_t op) { int ret = -1; dict_t *req_dict = NULL; - glusterd_op_t op = GD_OP_NONE; xlator_t *this = NULL; GF_ASSERT (req); @@ -515,11 +538,14 @@ glusterd_mgmt_v3_build_payload (dict_t **req, char **op_errstr, dict_t *dict) if (!req_dict) goto out; -/* OPS NEED TO COPY DICT TO REQ_DICT THEMSELVES - switch (op) { + switch (op) { + case GD_OP_SNAP: + dict_copy (dict, req_dict); + break; + default: + break; } -*/ *req = req_dict; ret = 0; @@ -1236,7 +1262,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op, } /* BUILD PAYLOAD */ - ret = glusterd_mgmt_v3_build_payload (&req_dict, &op_errstr, dict); + ret = glusterd_mgmt_v3_build_payload (&req_dict, &op_errstr, dict, op); if (ret) { gf_log (this->name, GF_LOG_ERROR, LOGSTR_BUILD_PAYLOAD, gd_op_list[op]); |