summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-06-11 16:21:04 +0530
committerAnand Avati <avati@redhat.com>2012-07-02 15:33:31 -0700
commitb9fd37b8a4973929bf3d5e756a1aa4fc803e8c27 (patch)
tree1834f5f050f62d4d5106878ce76f206c165aebb5
parente6c461abe5fd63baa25007e1880d0f04f3ae01bb (diff)
features/worm: Allow worm option to be set throught volume set
'volume set <volname> 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 <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/3545 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index a01d2a773eb..7745f940c9f 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;