summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-04-03 12:45:45 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-04-04 01:54:19 -0700
commitaaa3fd144f5f4495cf890918aa6b44472f559ba4 (patch)
treee5046d2c26886242ce4acc73a09465d9ea95e81e /xlators/mgmt/glusterd/src/glusterd-volgen.c
parentbff28bca0e79d67ecdec0ff7a240570b56fdcd7c (diff)
glusterd/snapshot: code cleanup and fixes for review comments
Change-Id: I358c30b42e71e5e1ddaeb5a3954bdd590671839b Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/7386 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c159
1 files changed, 0 insertions, 159 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index be5efd60c..6f3c69e7d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3175,40 +3175,6 @@ glusterd_generate_brick_volfile (glusterd_volinfo_t *volinfo,
return ret;
}
-static int
-glusterd_generate_snap_brick_volfile (glusterd_volinfo_t *volinfo,
- glusterd_brickinfo_t *brickinfo,
- glusterd_volinfo_t *snap_volinfo)
-{
- volgen_graph_t graph = {0,};
- char filename[PATH_MAX] = {0,};
- int ret = -1;
- char path[PATH_MAX] = {0,};
- char brick[PATH_MAX] = {0,};
- glusterd_conf_t *priv = NULL;
-
- priv = THIS->private;
- GF_ASSERT (volinfo);
- GF_ASSERT (brickinfo);
-
- GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, brick);
- GLUSTERD_GET_VOLUME_DIR (path, snap_volinfo, priv);
-
- snprintf (filename, PATH_MAX, "%s/%s.%s.%s.vol",
- path, snap_volinfo->volname,
- brickinfo->hostname,
- brick);
-
- ret = build_server_graph (&graph, snap_volinfo, NULL, brickinfo);
- if (!ret)
- ret = volgen_write_volfile (&graph, filename);
-
- volgen_graph_free (&graph);
-
- return ret;
-}
-
-
static void
get_vol_tstamp_file (char *filename, glusterd_volinfo_t *volinfo)
{
@@ -3276,32 +3242,6 @@ out:
return ret;
}
-int
-generate_snap_brick_volfiles (glusterd_volinfo_t *volinfo,
- glusterd_volinfo_t *snap_volinfo)
-{
- glusterd_brickinfo_t *brickinfo = NULL;
- int ret = -1;
-
- list_for_each_entry (brickinfo, &snap_volinfo->bricks, brick_list) {
- gf_log ("", GF_LOG_DEBUG,
- "Found a brick - %s:%s", brickinfo->hostname,
- brickinfo->path);
-
- ret = glusterd_generate_snap_brick_volfile (volinfo,
- brickinfo,
- snap_volinfo);
- if (ret)
- goto out;
- }
-
- ret = 0;
-
-out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
-}
-
static int
generate_single_transport_client_volfile (glusterd_volinfo_t *volinfo,
char *filepath, dict_t *dict)
@@ -3384,105 +3324,6 @@ out:
}
int
-generate_snap_client_volfiles (glusterd_volinfo_t *actual_volinfo,
- glusterd_volinfo_t *snap_volinfo,
- glusterd_client_type_t client_type,
- gf_boolean_t vol_restore)
-{
- char filepath[PATH_MAX] = {0,};
- int ret = -1;
- char *types[] = {NULL, NULL, NULL};
- int i = 0;
- dict_t *dict = NULL;
- gf_transport_type type = GF_TRANSPORT_TCP;
- char path[PATH_MAX] = {0, };
- xlator_t *this = NULL;
- glusterd_conf_t *conf = NULL;
-
- this = THIS;
- GF_ASSERT (this);
- conf = this->private;
- GF_ASSERT (conf);
-
- if (!actual_volinfo) {
- gf_log (this->name, GF_LOG_ERROR, "actual volinfo is NULL."
- "Unable to generate the client volfiles for snap");
- goto out;
- }
-
- if (!snap_volinfo) {
- gf_log (this->name, GF_LOG_ERROR, "snap volinfo is NULL. Unable"
- "to generate the client volfiles for snap (volume: %s)",
- actual_volinfo->volname);
- goto out;
- }
-
- enumerate_transport_reqs (actual_volinfo->transport_type, types);
- dict = dict_new ();
- if (!dict)
- goto out;
-
- /* If the brick volfile is generated as part of a restore
- * operation then we should be generating the brick volfile
- * in the origin volume folder instead of snap volume folder.
- */
- if (vol_restore) {
- GLUSTERD_GET_VOLUME_DIR (path, actual_volinfo, conf);
- } else {
- GLUSTERD_GET_VOLUME_DIR (path, snap_volinfo, conf);
- }
-
- for (i = 0; types[i]; i++) {
- memset (filepath, 0, sizeof (filepath));
- ret = dict_set_str (dict, "client-transport-type", types[i]);
- if (ret)
- goto out;
- type = transport_str_to_type (types[i]);
-
- ret = dict_set_uint32 (dict, "trusted-client", client_type);
- if (ret)
- goto out;
-
- if (client_type == GF_CLIENT_TRUSTED) {
- if ((actual_volinfo->transport_type ==
- GF_TRANSPORT_BOTH_TCP_RDMA) &&
- type == GF_TRANSPORT_RDMA) {
- snprintf (filepath, PATH_MAX,
- "%s/trusted-%s.rdma-fuse.vol",
- path, snap_volinfo->volname);
- } else {
- snprintf (filepath, PATH_MAX,
- "%s/trusted-%s-fuse.vol",
- path, snap_volinfo->volname);
- }
- } else {
- if ((actual_volinfo->transport_type ==
- GF_TRANSPORT_BOTH_TCP_RDMA) &&
- (type == GF_TRANSPORT_RDMA)) {
- snprintf (filepath, PATH_MAX, "%s/%s.rdma-fuse.vol",
- path, snap_volinfo->volname);
- } else {
- snprintf (filepath, PATH_MAX, "%s/%s-fuse.vol",
- path, snap_volinfo->volname);
- }
- }
-
- ret = generate_single_transport_client_volfile (snap_volinfo,
- filepath,
- dict);
- if (ret)
- goto out;
- }
-
-out:
- if (dict)
- dict_unref (dict);
-
- gf_log ("", GF_LOG_TRACE, "Returning %d", ret);
- return ret;
-}
-
-int
glusterd_create_rb_volfiles (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo)
{