diff options
author | Amar Tumballi <amar@gluster.com> | 2010-09-06 11:45:31 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-06 11:13:41 -0700 |
commit | e3a44226b3ed746260c4f3cf30d2f9f930fb7349 (patch) | |
tree | f937a9667249bd25ea1c7215e8d79d85b4031fbc /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | d38b2217393c460937505f30bd61576e7957f877 (diff) |
mgmt/glusterd: volume to have 'uuid'
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1548 (nfs should be able to get different uuid for different subvolumes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1548
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 07a7fca85fa..af672c9336c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1025,28 +1025,30 @@ out: int glusterd_handle_create_volume (rpcsvc_request_t *req) { - int32_t ret = -1; - gf1_cli_create_vol_req cli_req = {0,}; - dict_t *dict = NULL; - glusterd_brickinfo_t *brickinfo = NULL; - char *brick = NULL; - char *bricks = NULL; - char *volname = NULL; - int brick_count = 0; - char *tmpptr = NULL; - int i = 0; - glusterd_peerinfo_t *peerinfo = NULL; - char *brick_list = NULL; - void *cli_rsp = NULL; - char err_str[1048]; - gf1_cli_create_vol_rsp rsp = {0,}; - glusterd_conf_t *priv = NULL; - int err_ret = 0; - glusterd_brickinfo_t *tmpbrkinfo = NULL; - glusterd_volinfo_t *volinfo = NULL; - xlator_t *this = NULL; - char *free_ptr = NULL; - char *trans_type = NULL; + int32_t ret = -1; + gf1_cli_create_vol_req cli_req = {0,}; + dict_t *dict = NULL; + glusterd_brickinfo_t *brickinfo = NULL; + char *brick = NULL; + char *bricks = NULL; + char *volname = NULL; + int brick_count = 0; + char *tmpptr = NULL; + int i = 0; + glusterd_peerinfo_t *peerinfo = NULL; + char *brick_list = NULL; + void *cli_rsp = NULL; + char err_str[1048]; + gf1_cli_create_vol_rsp rsp = {0,}; + glusterd_conf_t *priv = NULL; + int err_ret = 0; + glusterd_brickinfo_t *tmpbrkinfo = NULL; + glusterd_volinfo_t *volinfo = NULL; + xlator_t *this = NULL; + char *free_ptr = NULL; + char *trans_type = NULL; + uuid_t volume_id = {0,}; + char volid[64] = {0,}; GF_ASSERT (req); @@ -1111,6 +1113,16 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) goto out; } + uuid_generate (volume_id); + uuid_unparse (volume_id, volid); + free_ptr = gf_strdup (volid); + ret = dict_set_dynstr (dict, "volume-id", free_ptr); + if (ret) { + gf_log ("", GF_LOG_ERROR, "unable to set volume-id"); + goto out; + } + free_ptr = NULL; + if (bricks) { brick_list = gf_strdup (bricks); free_ptr = brick_list; @@ -2598,6 +2610,10 @@ glusterd_create_volume (rpcsvc_request_t *req, dict_t *dict) if (!data) goto out; + data = dict_get (dict, "volume-id"); + if (!data) + goto out; + ret = glusterd_op_txn_begin (); out: |