From b9fd37b8a4973929bf3d5e756a1aa4fc803e8c27 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 11 Jun 2012 16:21:04 +0530 Subject: features/worm: Allow worm option to be set throught volume set 'volume set worm on' adds the worm xlator on the bricks. Read-only and worm cannot exist together, and a check is added. Regular volumes can still be mounted with worm mount option. If a volume is started before conversion to worm, the bricks need to be restarted for the option to take force. Updated feature.read-only option to features.read-only to keep it consistent with other features based options. Change-Id: I1a8fab363aaf66e6da615dcffa328332ae39fa04 BUG: 811612 Signed-off-by: shishir gowda Reviewed-on: http://review.gluster.com/3545 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index a01d2a77..7745f940 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -234,7 +234,8 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {"features.lock-heal", "protocol/server", "lk-heal", NULL, DOC, 0}, {"features.grace-timeout", "protocol/client", "grace-timeout", NULL, NO_DOC, 0}, {"features.grace-timeout", "protocol/server", "grace-timeout", NULL, DOC, 0}, - {"feature.read-only", "features/read-only", "!read-only", "off", DOC, 0}, + {"features.read-only", "features/read-only", "!read-only", "off", DOC, 0}, + {"features.worm", "features/worm", "!worm", "off", DOC, 0}, {NULL, } }; @@ -1736,8 +1737,16 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) return -1; + if (dict_get_str_boolean (set_dict, "features.read-only", 0) && + dict_get_str_boolean (set_dict, "features.worm",0)) { + gf_log (THIS->name, GF_LOG_ERROR, + "read-only and worm cannot be set together"); + ret = -1; + goto out; + } + /* Check for read-only volume option, and add it to the graph */ - if (dict_get_str_boolean (set_dict, "feature.read-only", 0)) { + if (dict_get_str_boolean (set_dict, "features.read-only", 0)) { xl = volgen_graph_add (graph, "features/read-only", volname); if (!xl) { ret = -1; @@ -1745,6 +1754,15 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, } } + /* Check for worm volume option, and add it to the graph */ + if (dict_get_str_boolean (set_dict, "features.worm", 0)) { + xl = volgen_graph_add (graph, "features/worm", volname); + if (!xl) { + ret = -1; + goto out; + } + } + xl = volgen_graph_add_as (graph, "debug/io-stats", path); if (!xl) return -1; -- cgit