From ef44323b4ba58fa8c1eb89105851983f828dd91b Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Sat, 2 Oct 2010 07:30:39 +0000 Subject: volgen: reimplement volgen Generating a volfile occurs in two steps: - Build a graph (ie, glusterfs_graph_t instance) by graph manipulation primitives - Write out the graph to a file by the the graph printing API. Graph builder routines can optionally make use of a "modifier dict", which can contain overrides wrt. volume options. This can be used for a "dry-run" graph generation. Signed-off-by: Csaba Henk Signed-off-by: Vijay Bellur BUG: 1750 (clean up volgen) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1750 --- xlators/mgmt/glusterd/src/glusterd-utils.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 3fa965c88..8ad9379a7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -495,8 +495,8 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo) INIT_LIST_HEAD (&new_volinfo->vol_list); INIT_LIST_HEAD (&new_volinfo->bricks); - ret = glusterd_default_xlator_options (new_volinfo); - if (ret) { + new_volinfo->dict = dict_new (); + if (!new_volinfo->dict) { if (new_volinfo) GF_FREE (new_volinfo); @@ -1620,7 +1620,7 @@ glusterd_nfs_server_start () glusterd_conf_t *priv = NULL; char pidfile[PATH_MAX] = {0,}; char logfile[PATH_MAX] = {0,}; - char *volfile = NULL; + char volfile[PATH_MAX] = {0,}; char path[PATH_MAX] = {0,}; char cmd_str[8192] = {0,}; char rundir[PATH_MAX] = {0,}; @@ -1641,11 +1641,7 @@ glusterd_nfs_server_start () } GLUSTERD_GET_NFS_PIDFILE(pidfile); - volfile = glusterd_get_nfs_filepath (); - if (!volfile) { - ret = -1; - goto out; - } + glusterd_get_nfs_filepath (volfile); ret = access (volfile, F_OK); if (ret) { @@ -1662,8 +1658,6 @@ glusterd_nfs_server_start () ret = gf_system (cmd_str); out: - if (volfile) - GF_FREE(volfile); return ret; } @@ -1721,7 +1715,7 @@ glusterd_check_generate_start_nfs (glusterd_volinfo_t *volinfo) goto out; } - ret = volgen_generate_nfs_volfile (volinfo); + ret = glusterd_create_nfs_volfile (); if (ret) goto out; -- cgit