From 29a3dc028d2847bd8421b23b7c7ee5419bd30392 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 12 Mar 2012 12:53:01 +0530 Subject: mgmt/glusterd: provide an option to make a volume read-only this can be triggered by "gluster volume set read-only on", which adds read-only translator on server graph, thus making the volume read-only. Change-Id: Iee32e6b2f3022d16016534914a5198d1cd327e25 Signed-off-by: Amar Tumballi BUG: 798877 Reviewed-on: http://review.gluster.com/2915 Tested-by: Gluster Build System Reviewed-by: Kaushal M Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 4b51054fa..91696303a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -204,6 +204,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {"client.lk-heal", "protocol/client", "lk-heal", NULL, DOC, 0}, {"client.grace-timeout", "protocol/client", "grace-timeout", NULL, DOC, 0}, {"server.grace-timeout", "protocol/server", "grace-timeout", NULL, DOC, 0}, + {"feature.read-only", "features/read-only", "!read-only", "off", DOC, 0}, {NULL, } }; @@ -1708,6 +1709,15 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) return -1; + /* Check for read-only volume option, and add it to the graph */ + if (dict_get_str_boolean (set_dict, "feature.read-only", 0)) { + xl = volgen_graph_add (graph, "features/read-only", volname); + if (!xl) { + ret = -1; + goto out; + } + } + xl = volgen_graph_add_as (graph, "debug/io-stats", path); if (!xl) return -1; -- cgit